autodrive.dtypes

Module Contents

Classes

String

String datatype, covers all non-numeric/date text that isn't a formula.

Formula

Formula datatype, essentially a string, but begins with =.

Number

Number datatype, covers both floats and integers, though internally Number is

Boolean

Boolean datatype, appears in Google Sheets as FALSE or TRUE.

GoogleValueType

Metaclass for the three different ways values are stored in Google Sheets.

UserEnteredVal

UserEnteredVal is the value as entered by the user, without any calculations

EffectiveVal

EffectiveVal is the value as displayed in Google Sheets, and is appropriately

FormattedVal

The untyped string value of the cell as displayed in Google Sheets. Essentially

BorderStyle

A property describing the style of border to apply to part of a cell.

BorderSide

A property describing which side of a cell to apply border properties to.

VerticalAlign

A property describing vertical text alignment.

HorizontalAlign

A property describing horizontal text alignment.

Attributes

GOOGLE_VAL_TYPES

A tuple of UserEnteredVal, EffectiveVal, and FormattedVal google value types.

GOOGLE_DTYPES

A tuple of String, Formula, Number, and Boolean google data types.

TYPE_MAP

Dictionary mapping python data types to corresponding google data types.

REV_TYPE_MAP

Dictionary mapping google data types to corresponding python types.

UserEnteredFmt

The formatting properties the user as applied to the cell.

EffectiveFmt

The final formatting information about a cell and its values, includes the

DefaultFmt

The default formatting properties of a cell, dictated by the settings of the tab.

BorderSolid

The default border style, a thin, solid line.

BorderSolidMedium

Same as BorderSolid, but slightly thicker.

BorderSolidThick

Same as BorderSolid, but much thicker.

BorderDashed

A thin line comprised of dashes.

BorderDotted

A thin line comprised of dots.

BorderDoubleLine

A set of two parallel lines.

BorderLeft

The border for the left side of a cell.

BorderRight

The border for the right side of a cell.

BorderTop

The border for the top side of a cell.

BorderBottom

The border for the bottom side of a cell.

BorderSides

Convenience reference for all BorderSide objects.

AlignTop

Align text to the top of the cell(s).

AlignMiddle

Align text to the middle of the cell(s).

AlignBottom

Align text to the middle of the cell(s).

AlignLeft

Align text to the left of the cell(s).

AlignCenter

Align text to the center of the cell(s).

AlignRight

Align text to the right of the cell(s).

class autodrive.dtypes.String

String datatype, covers all non-numeric/date text that isn’t a formula.

python_type
type_key = stringValue
classmethod parse(value)

Converts a string into a string.

Parameters

value (str) – Any string.

Returns

The passed value as a string.

Return type

str

class autodrive.dtypes.Formula

Formula datatype, essentially a string, but begins with =.

python_type
type_key = formulaValue
classmethod parse(value)

Converts a string into a formula (string).

Parameters

value (str) – Any string.

Returns

The passed value as a string.

Return type

str

class autodrive.dtypes.Number

Number datatype, covers both floats and integers, though internally Number is treated as a float so as to not lose significant digits.

python_type
type_key = numberValue
classmethod parse(value)

Converts a string into an integer (if it has no decimal point) or float.

Parameters

value (str) – Any numeric string.

Returns

The passed value as an integer or float.

Return type

float | int

class autodrive.dtypes.Boolean

Boolean datatype, appears in Google Sheets as FALSE or TRUE.

python_type
type_key = boolValue
classmethod parse(value)

Converts a string into a boolean.

Parameters

value (str) – Any string.

Returns

False if the string is some variation of FALSE, otherwise True for all other strings.

Return type

bool

class autodrive.dtypes.GoogleValueType

Metaclass for the three different ways values are stored in Google Sheets.

value_key :str

The API key for the GoogleValueType.

has_dtype :bool = True

Whether dtype information can be extracted from the GoogleValueType.

class autodrive.dtypes.UserEnteredVal

UserEnteredVal is the value as entered by the user, without any calculations applied to it. It is always a string, but is accompanied by metadata that indicates what datatype the value is.

value_key = userEnteredValue
class autodrive.dtypes.EffectiveVal

EffectiveVal is the value as displayed in Google Sheets, and is appropriately typed when read from the api. So if the formula “=A1+A2” would equal 3, then the EffectiveVal of that cell is 3.

value_key = effectiveValue
class autodrive.dtypes.FormattedVal

The untyped string value of the cell as displayed in Google Sheets. Essentially equivalent to EffectiveVal, but without appropriate typing.

value_key = formattedValue
has_dtype = False
autodrive.dtypes.GOOGLE_VAL_TYPES

A tuple of UserEnteredVal, EffectiveVal, and FormattedVal google value types.

autodrive.dtypes.GOOGLE_DTYPES

A tuple of String, Formula, Number, and Boolean google data types.

autodrive.dtypes.TYPE_MAP

Dictionary mapping python data types to corresponding google data types.

autodrive.dtypes.REV_TYPE_MAP

Dictionary mapping google data types to corresponding python types.

autodrive.dtypes.UserEnteredFmt

The formatting properties the user as applied to the cell.

autodrive.dtypes.EffectiveFmt

The final formatting information about a cell and its values, includes the effects of conditional formatting and the like.

autodrive.dtypes.DefaultFmt

The default formatting properties of a cell, dictated by the settings of the tab.

class autodrive.dtypes.BorderStyle(style)

A property describing the style of border to apply to part of a cell.

Parameters

style (str) – The name of the style.

autodrive.dtypes.BorderSolid

The default border style, a thin, solid line.

autodrive.dtypes.BorderSolidMedium

Same as BorderSolid, but slightly thicker.

autodrive.dtypes.BorderSolidThick

Same as BorderSolid, but much thicker.

autodrive.dtypes.BorderDashed

A thin line comprised of dashes.

autodrive.dtypes.BorderDotted

A thin line comprised of dots.

autodrive.dtypes.BorderDoubleLine

A set of two parallel lines.

class autodrive.dtypes.BorderSide(side)

A property describing which side of a cell to apply border properties to.

Parameters

side (str) – The name of the side.

autodrive.dtypes.BorderLeft

The border for the left side of a cell.

autodrive.dtypes.BorderRight

The border for the right side of a cell.

autodrive.dtypes.BorderTop

The border for the top side of a cell.

autodrive.dtypes.BorderBottom

The border for the bottom side of a cell.

autodrive.dtypes.BorderSides

Convenience reference for all BorderSide objects.

class autodrive.dtypes.VerticalAlign(align_str)

A property describing vertical text alignment.

Parameters

align_str (str) –

class autodrive.dtypes.HorizontalAlign(align_str)

A property describing horizontal text alignment.

Parameters

align_str (str) –

autodrive.dtypes.AlignTop

Align text to the top of the cell(s).

autodrive.dtypes.AlignMiddle

Align text to the middle of the cell(s).

autodrive.dtypes.AlignBottom

Align text to the middle of the cell(s).

autodrive.dtypes.AlignLeft

Align text to the left of the cell(s).

autodrive.dtypes.AlignCenter

Align text to the center of the cell(s).

autodrive.dtypes.AlignRight

Align text to the right of the cell(s).