Paper Office
paper-xlsxAPI referenceutils.cell

openpyxl.utils.cell

paper-xlsx 0.2.1 API reference

Collection of utilities used within the package and also available for client code

ABSOLUTE_RE

attributeABSOLUTE_RE
= re.compile('^' + RANGE_EXPR + '$', re.VERBOSE)

COL_RANGE

attributeCOL_RANGE
= '[A-Z]{1,3}:[A-Z]{1,3}:'

COORD_RE

attributeCOORD_RE
= re.compile('^[$]?([A-Za-z]{1,3})[$]?(\\d+)$')

RANGE_EXPR

attributeRANGE_EXPR
= '\n[$]?(?P<min_col>[A-Za-z]{1,3})?\n[$]?(?P<min_row>\\d+)?\n(:[$]?(?P<max_col>[A-Za-z]{1,3})?\n[$]?(?P<max_row>\\d+)?)?\n'

ROW_RANGE

attributeROW_RANGE
= '\\d+:\\d+:'

SHEETRANGE_RE

attributeSHEETRANGE_RE
= re.compile('{0}(?P<cells>{1})(?=,?)'.format(SHEET_TITLE, RANGE_EXPR), re.VERBOSE)

SHEET_TITLE

attributeSHEET_TITLE
= "\n(('(?P<quoted>([^']|'')*)')|(?P<notquoted>[^'^ ^!]*))!"

absolute_coordinate

funcabsolute_coordinate(coord_string)

Convert a coordinate to an absolute coordinate string (B12 -> $B$12)

paramcoord_string

cols_from_range

funccols_from_range(range_string)

Get individual addresses for every cell in a range. Yields one row at a time.

paramrange_string

column_index_from_string

funccolumn_index_from_string(col)

Convert ASCII column name (base 26) to decimal with 1-based index

Characters represent descending multiples of powers of 26

"AFZ" == 26 * pow(26, 0) + 6 * pow(26, 1) + 1 * pow(26, 2)

paramcol

coordinate_from_string

funccoordinate_from_string(coord_string)

Convert a coordinate string like 'B12' to a tuple ('B', 12)

paramcoord_string

coordinate_to_tuple

funccoordinate_to_tuple(coordinate)

Convert an Excel style coordinate to (row, column) tuple

paramcoordinate

get_column_interval

funcget_column_interval(start, end)

Given the start and end columns, return all the columns in the series.

The start and end columns can be either column letters or 1-based indexes.

paramstart
paramend

get_column_letter

funcget_column_letter(col_idx)

Convert decimal column position to its ASCII (base 26) form.

Because column indices are 1-based, strides are actually pow(26, n) + 26 Hence, a correction is applied between pow(26, n) and pow(26, 2) + 26 to prevent and additional column letter being prepended

"A" == 1 == pow(26, 0) "Z" == 26 == pow(26, 0) + 26 // decimal equivalent 10 "AA" == 27 == pow(26, 1) + 1 "ZZ" == 702 == pow(26, 2) + 26 // decimal equivalent 100

paramcol_idx

quote_sheetname

funcquote_sheetname(sheetname)

Add quotes around sheetnames if they contain spaces.

paramsheetname

range_boundaries

funcrange_boundaries(range_string)

Convert a range string into a tuple of boundaries: (min_col, min_row, max_col, max_row) Cell coordinates will be converted into a range with the cell at both end

paramrange_string

range_to_tuple

funcrange_to_tuple(range_string)

Convert a worksheet range to the sheetname and maximum and minimum coordinate indices

paramrange_string

rows_from_range

funcrows_from_range(range_string)

Get individual addresses for every cell in a range. Yields one row at a time.

paramrange_string

On this page