xlrd package

Submodules

xlrd.biffh module

class xlrd.biffh.BaseObject[source]

Bases: object

dump(f=None, header=None, footer=None, indent=0)[source]
exception xlrd.biffh.XLRDError[source]

Bases: exceptions.Exception

xlrd.biffh.biff_count_records(mem, stream_offset, stream_len, fout=<open file '<stdout>', mode 'w'>)[source]
xlrd.biffh.biff_dump(mem, stream_offset, stream_len, base=0, fout=<open file '<stdout>', mode 'w'>, unnumbered=False)[source]
xlrd.biffh.hex_char_dump(strg, ofs, dlen, base=0, fout=<open file '<stdout>', mode 'w'>, unnumbered=False)[source]
xlrd.biffh.is_cell_opcode(c)[source]
xlrd.biffh.unpack_cell_range_address_list_update_pos(output_list, data, pos, biff_version, addr_size=6)[source]
xlrd.biffh.unpack_string(data, pos, encoding, lenlen=1)[source]
xlrd.biffh.unpack_string_update_pos(data, pos, encoding, lenlen=1, known_len=None)[source]
xlrd.biffh.unpack_unicode(data, pos, lenlen=2)[source]

Return unicode_strg

xlrd.biffh.unpack_unicode_update_pos(data, pos, lenlen=2, known_len=None)[source]

Return (unicode_strg, updated value of pos)

xlrd.biffh.upkbits(tgt_obj, src, manifest, local_setattr=<built-in function setattr>)[source]
xlrd.biffh.upkbitsL(tgt_obj, src, manifest, local_setattr=<built-in function setattr>, local_int=<type 'int'>)[source]

xlrd.book module

class xlrd.book.Book[source]

Bases: xlrd.biffh.BaseObject

biff2_8_load(filename=None, file_contents=None, logfile=<open file '<stdout>', mode 'w'>, verbosity=0, use_mmap=1, encoding_override=None, formatting_info=False, on_demand=False, ragged_rows=False)[source]
biff_version = 0
codepage = None
colour_map = {}
countries = (0, 0)
datemode = 0
derive_encoding()[source]
encoding = None
fake_globals_get_sheet()[source]
font_list = []
format_list = []
format_map = {}
get2bytes()[source]
get_record_parts()[source]
get_record_parts_conditional(reqd_record)[source]
get_sheet(sh_number, update_pos=True)[source]
get_sheets()[source]
getbof(rqd_stream)[source]
handle_boundsheet(data)[source]
handle_builtinfmtcount(data)[source]
handle_codepage(data)[source]
handle_country(data)[source]
handle_datemode(data)[source]
handle_externname(data)[source]
handle_externsheet(data)[source]
handle_filepass(data)[source]
handle_name(data)[source]
handle_obj(data)[source]
handle_sheethdr(data)[source]
handle_sheetsoffset(data)[source]
handle_sst(data)[source]
handle_supbook(data)[source]
handle_writeaccess(data)[source]
initialise_format_info()[source]
load_time_stage_1 = -1.0
load_time_stage_2 = -1.0
name_and_scope_map = {}
name_map = {}
name_obj_list = []
names_epilogue()[source]
nsheets = 0
palette_record = []
parse_globals()[source]
read(pos, length)[source]
release_resources()[source]
sheet_by_index(sheetx)[source]
sheet_by_name(sheet_name)[source]
sheet_loaded(sheet_name_or_index)[source]
sheet_names()[source]
sheets()[source]
style_name_map = {}
unload_sheet(sheet_name_or_index)[source]
user_name = u''
xf_list = []
class xlrd.book.Name[source]

Bases: xlrd.biffh.BaseObject

area2d(clipped=True)[source]
binary = 0
book = None
builtin = 0
cell()[source]
complex = 0
func = 0
funcgroup = 0
hidden = 0
macro = 0
name = u''
name_index = 0
raw_formula = ''
result = None
scope = -1
vbasic = 0
xlrd.book.colname(colx, _A2Z='ABCDEFGHIJKLMNOPQRSTUVWXYZ')[source]
xlrd.book.count_records(filename, outfile=<open file '<stdout>', mode 'w'>)[source]
xlrd.book.display_cell_address(rowx, colx, relrow, relcol)[source]
xlrd.book.dump(filename, outfile=<open file '<stdout>', mode 'w'>, unnumbered=False)[source]
xlrd.book.expand_cell_address(inrow, incol)[source]
xlrd.book.open_workbook_xls(filename=None, logfile=<open file '<stdout>', mode 'w'>, verbosity=0, use_mmap=1, file_contents=None, encoding_override=None, formatting_info=False, on_demand=False, ragged_rows=False)[source]
xlrd.book.unpack_SST_table(datatab, nstrings)[source]

Return list of strings

xlrd.compdoc module

class xlrd.compdoc.CompDoc(mem, logfile=<open file '<stdout>', mode 'w'>, DEBUG=0)[source]

Bases: object

get_named_stream(qname)[source]
locate_named_stream(qname)[source]
exception xlrd.compdoc.CompDocError[source]

Bases: exceptions.Exception

class xlrd.compdoc.DirNode(DID, dent, DEBUG=0, logfile=<open file '<stdout>', mode 'w'>)[source]

Bases: object

dump(DEBUG=1)[source]
xlrd.compdoc.dump_list(alist, stride, f=<open file '<stdout>', mode 'w'>)[source]
xlrd.compdoc.x_dump_line(alist, stride, f, dpos, equal=0)[source]

xlrd.formatting module

class xlrd.formatting.EqNeAttrs[source]

Bases: object

class xlrd.formatting.Font[source]

Bases: xlrd.biffh.BaseObject, xlrd.formatting.EqNeAttrs

bold = 0
character_set = 0
colour_index = 0
escapement = 0
family = 0
font_index = 0
height = 0
italic = 0
name = u''
outline = 0
shadow = 0
struck_out = 0
underline_type = 0
underlined = 0
weight = 400
class xlrd.formatting.Format(format_key, ty, format_str)[source]

Bases: xlrd.biffh.BaseObject, xlrd.formatting.EqNeAttrs

format_key = 0
format_str = u''
type = 0
class xlrd.formatting.XF[source]

Bases: xlrd.biffh.BaseObject

alignment = None
background = None
border = None
font_index = 0
format_key = 0
is_style = 0
parent_style_index = 0
protection = None
xf_index = 0
class xlrd.formatting.XFAlignment[source]

Bases: xlrd.biffh.BaseObject, xlrd.formatting.EqNeAttrs

hor_align = 0
indent_level = 0
rotation = 0
shrink_to_fit = 0
text_direction = 0
text_wrapped = 0
vert_align = 0
class xlrd.formatting.XFBackground[source]

Bases: xlrd.biffh.BaseObject, xlrd.formatting.EqNeAttrs

background_colour_index = 0
fill_pattern = 0
pattern_colour_index = 0
class xlrd.formatting.XFBorder[source]

Bases: xlrd.biffh.BaseObject, xlrd.formatting.EqNeAttrs

bottom_colour_index = 0
bottom_line_style = 0
diag_colour_index = 0
diag_down = 0
diag_line_style = 0
diag_up = 0
left_colour_index = 0
left_line_style = 0
right_colour_index = 0
right_line_style = 0
top_colour_index = 0
top_line_style = 0
class xlrd.formatting.XFProtection[source]

Bases: xlrd.biffh.BaseObject, xlrd.formatting.EqNeAttrs

cell_locked = 0
formula_hidden = 0
xlrd.formatting.check_colour_indexes_in_obj(book, obj, orig_index)[source]
xlrd.formatting.fill_in_standard_formats(book)[source]
xlrd.formatting.fmt_bracketed_sub()

sub(repl, string[, count = 0]) –> newstring Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.

xlrd.formatting.handle_efont(book, data)[source]
xlrd.formatting.handle_font(book, data)[source]
xlrd.formatting.handle_format(self, data, rectype=1054)[source]
xlrd.formatting.handle_palette(book, data)[source]
xlrd.formatting.handle_style(book, data)[source]
xlrd.formatting.handle_xf(self, data)[source]
xlrd.formatting.initialise_book(book)[source]
xlrd.formatting.initialise_colour_map(book)[source]
xlrd.formatting.is_date_format_string(book, fmt)[source]
xlrd.formatting.nearest_colour_index(colour_map, rgb, debug=0)[source]
xlrd.formatting.palette_epilogue(book)[source]
xlrd.formatting.xf_epilogue(self)[source]

xlrd.formula module

xlrd.formula.decompile_formula(bk, fmla, fmlalen, fmlatype=None, browx=None, bcolx=None, blah=0, level=0, r1c1=0)[source]
xlrd.formula.dump_formula(bk, data, fmlalen, bv, reldelta, blah=0, isname=0)[source]
xlrd.formula.evaluate_name_formula(bk, nobj, namex, blah=0, level=0)[source]
xlrd.formula.rangename3d(book, ref3d)[source]

Ref3D(1, 4, 5, 20, 7, 10) => ‘Sheet2:Sheet3!$H$6:$J$20’ (assuming Excel’s default sheetnames)

xlrd.formula.rangename3drel(book, ref3d, browx=None, bcolx=None, r1c1=0)[source]
xlrd.formula.cellname(rowx, colx)[source]

(5, 7) => ‘H6’

xlrd.formula.cellnameabs(rowx, colx, r1c1=0)[source]

(5, 7) => ‘$H$6’ or ‘R8C6’

xlrd.formula.colname(colx)[source]

7 => ‘H’, 27 => ‘AB’

xlrd.info module

xlrd.licences module

Portions copyright © 2005-2009, Stephen John Machin, Lingfo Pty Ltd All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. None of the names of Stephen John Machin, Lingfo Pty Ltd and any contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

xlrd.sheet module

class xlrd.sheet.Cell(ctype, value, xf_index=None)[source]

Bases: xlrd.biffh.BaseObject

ctype
value
xf_index
class xlrd.sheet.Colinfo[source]

Bases: xlrd.biffh.BaseObject

bit1_flag = 0
collapsed = 0
hidden = 0
outline_level = 0
width = 0
xf_index = -1

Bases: xlrd.biffh.BaseObject

desc = None
fcolx = None
frowx = None
lcolx = None
lrowx = None
quicktip = None
target = None
textmark = None
type = None
url_or_path = None
class xlrd.sheet.MSODrawing[source]

Bases: xlrd.biffh.BaseObject

class xlrd.sheet.MSObj[source]

Bases: xlrd.biffh.BaseObject

class xlrd.sheet.MSTxo[source]

Bases: xlrd.biffh.BaseObject

class xlrd.sheet.Note[source]

Bases: xlrd.biffh.BaseObject

author = u''
col_hidden = 0
colx = 0
rich_text_runlist = None
row_hidden = 0
rowx = 0
show = 0
text = u''
class xlrd.sheet.Rowinfo[source]

Bases: xlrd.biffh.BaseObject

additional_space_above
additional_space_below
has_default_height
has_default_xf_index
height
height_mismatch
hidden
outline_group_starts_ends
outline_level
xf_index
class xlrd.sheet.Sheet(book, position, name, number)[source]

Bases: xlrd.biffh.BaseObject

book = None
cell(rowx, colx)[source]
cell_note_map = {}
cell_type(rowx, colx)[source]
cell_value(rowx, colx)[source]
cell_xf_index(rowx, colx)[source]
col(colx, start_rowx=0, end_rowx=None)[source]
col_label_ranges = []
col_slice(colx, start_rowx=0, end_rowx=None)[source]
col_types(colx, start_rowx=0, end_rowx=None)[source]
col_values(colx, start_rowx=0, end_rowx=None)[source]
colinfo_map = {}
computed_column_width(colx)[source]
default_additional_space_above = None
default_additional_space_below = None
default_row_height = None
default_row_height_mismatch = None
default_row_hidden = None
defcolwidth = None
fake_XF_from_BIFF20_cell_attr(cell_attr, style=0)[source]
fixed_BIFF2_xfindex(cell_attr, rowx, colx, true_xfx=None)[source]
gcw = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
handle_feat11(data)[source]
handle_msodrawingetc(recid, data_len, data)[source]
handle_note(data, txos)[source]
handle_obj(data)[source]
handle_quicktip(data)[source]
handle_txo(data)[source]
has_pane_record = 0
horizontal_page_breaks = []
horz_split_first_visible = 0
horz_split_pos = 0
insert_new_BIFF20_xf(cell_attr, style=0)[source]
merged_cells = []
name = ''
ncols = 0
nrows = 0
put_cell_ragged(rowx, colx, ctype, value, xf_index)[source]
put_cell_unragged(rowx, colx, ctype, value, xf_index)[source]
read(bk)[source]
req_fmt_info()[source]
rich_text_runlist_map = {}
row(rowx)[source]
row_label_ranges = []
row_len(rowx)[source]
row_slice(rowx, start_colx=0, end_colx=None)[source]
row_types(rowx, start_colx=0, end_colx=None)[source]
row_values(rowx, start_colx=0, end_colx=None)[source]
rowinfo_map = {}
split_active_pane = 0
standardwidth = None
string_record_contents(data)[source]
tidy_dimensions()[source]
update_cooked_mag_factors()[source]
vert_split_first_visible = 0
vert_split_pos = 0
vertical_page_breaks = []
visibility = 0
xlrd.sheet.unpack_RK(rk_str)[source]

xlrd.timemachine module

xlrd.timemachine.BYTES_LITERAL(x)
xlrd.timemachine.UNICODE_LITERAL(x)
xlrd.timemachine.fprintf(f, fmt, *vargs)[source]

xlrd.xldate module

exception xlrd.xldate.XLDateAmbiguous[source]

Bases: xlrd.xldate.XLDateError

exception xlrd.xldate.XLDateBadDatemode[source]

Bases: xlrd.xldate.XLDateError

exception xlrd.xldate.XLDateBadTuple[source]

Bases: xlrd.xldate.XLDateError

exception xlrd.xldate.XLDateError[source]

Bases: exceptions.ValueError

exception xlrd.xldate.XLDateNegative[source]

Bases: xlrd.xldate.XLDateError

exception xlrd.xldate.XLDateTooLarge[source]

Bases: xlrd.xldate.XLDateError

xlrd.xldate.xldate_as_datetime(xldate, datemode)[source]

Convert an Excel date/time number into a datetime.datetime object.

xlrd.xldate.xldate_as_tuple(xldate, datemode)[source]
xlrd.xldate.xldate_from_date_tuple(date_tuple, datemode)[source]

Create an excel date from a tuple of (year, month, day)

xlrd.xldate.xldate_from_datetime_tuple(datetime_tuple, datemode)[source]
xlrd.xldate.xldate_from_time_tuple(time_tuple)[source]

Create an excel date from a tuple of (hour, minute, second)

xlrd.xlsx module

class xlrd.xlsx.X12Book(bk, logfile=<open file '<stdout>', mode 'w'>, verbosity=False)[source]

Bases: xlrd.xlsx.X12General

core_props_menu = {u'{http://purl.org/dc/terms/}created': (u'created', <function cnv_ST_Xstring at 0x7fdfbd83a320>), u'{http://schemas.openxmlformats.org/package/2006/metadata/core-properties}lastModifiedBy': (u'last_modified_by', <function cnv_ST_Xstring at 0x7fdfbd83a320>), u'{http://purl.org/dc/terms/}modified': (u'modified', <function cnv_ST_Xstring at 0x7fdfbd83a320>), u'{http://purl.org/dc/elements/1.1/}creator': (u'creator', <function cnv_ST_Xstring at 0x7fdfbd83a320>)}
do_defined_name(elem)[source]
do_defined_names(elem)[source]
do_sheet(elem)[source]
do_workbookpr(elem)[source]
process_coreprops(stream)[source]
process_rels(stream)[source]
tag2meth = {u'sheet': <function do_sheet at 0x7fdfbd83a9b0>, u'definedNames': <function do_defined_names at 0x7fdfbd83a938>, u'{http://schemas.openxmlformats.org/spreadsheetml/2006/main}definedNames': <function do_defined_names at 0x7fdfbd83a938>, u'workbookPr': <function do_workbookpr at 0x7fdfbd83aa28>, u'{http://schemas.openxmlformats.org/spreadsheetml/2006/main}sheet': <function do_sheet at 0x7fdfbd83a9b0>, u'{http://schemas.openxmlformats.org/spreadsheetml/2006/main}workbookPr': <function do_workbookpr at 0x7fdfbd83aa28>}
class xlrd.xlsx.X12General[source]

Bases: object

dump_elem(elem)[source]
dumpout(fmt, *vargs)[source]
finish_off()[source]
process_stream(stream, heading=None)[source]
class xlrd.xlsx.X12SST(bk, logfile=<open file '<stdout>', mode 'w'>, verbosity=0)[source]

Bases: xlrd.xlsx.X12General

process_stream_findall(stream, heading=None)[source]
process_stream_iterparse(stream, heading=None)[source]
class xlrd.xlsx.X12Sheet(sheet, logfile=<open file '<stdout>', mode 'w'>, verbosity=0)[source]

Bases: xlrd.xlsx.X12General

do_dimension(elem)[source]
do_merge_cell(elem)[source]
do_row(row_elem)[source]
own_process_stream(stream, heading=None)[source]
process_comments_stream(stream)[source]
tag2meth = {u'{http://schemas.openxmlformats.org/spreadsheetml/2006/main}row': <function do_row at 0x7fdfbd999140>, u'row': <function do_row at 0x7fdfbd999140>}
class xlrd.xlsx.X12Styles(bk, logfile=<open file '<stdout>', mode 'w'>, verbosity=0)[source]

Bases: xlrd.xlsx.X12General

do_cellstylexfs(elem)[source]
do_cellxfs(elem)[source]
do_numfmt(elem)[source]
do_xf(elem)[source]
tag2meth = {u'{http://schemas.openxmlformats.org/spreadsheetml/2006/main}numFmt': <function do_numfmt at 0x7fdfbd83ad70>, u'{http://schemas.openxmlformats.org/spreadsheetml/2006/main}cellXfs': <function do_cellxfs at 0x7fdfbd83acf8>, u'cellXfs': <function do_cellxfs at 0x7fdfbd83acf8>, u'{http://schemas.openxmlformats.org/spreadsheetml/2006/main}xf': <function do_xf at 0x7fdfbd83ade8>, u'xf': <function do_xf at 0x7fdfbd83ade8>, u'cellStyleXfs': <function do_cellstylexfs at 0x7fdfbd83ac80>, u'{http://schemas.openxmlformats.org/spreadsheetml/2006/main}cellStyleXfs': <function do_cellstylexfs at 0x7fdfbd83ac80>, u'numFmt': <function do_numfmt at 0x7fdfbd83ad70>}
xlrd.xlsx.augment_keys(adict, uri)[source]
xlrd.xlsx.cell_name_to_rowx_colx(cell_name, letter_value={u'1': 0, u'3': 0, u'2': 0, u'5': 0, u'4': 0, u'7': 0, u'6': 0, u'9': 0, u'8': 0, u'A': 1, u'C': 3, u'B': 2, u'E': 5, u'D': 4, u'G': 7, u'F': 6, u'I': 9, u'H': 8, u'K': 11, u'J': 10, u'M': 13, u'L': 12, u'O': 15, u'N': 14, u'Q': 17, u'P': 16, u'S': 19, u'R': 18, u'U': 21, u'T': 20, u'W': 23, u'V': 22, u'Y': 25, u'X': 24, u'Z': 26})[source]
xlrd.xlsx.cnv_ST_Xstring(s)[source]
xlrd.xlsx.cnv_xsd_boolean(s)[source]
xlrd.xlsx.cnv_xsd_unsignedInt(s)[source]
xlrd.xlsx.cooked_text(self, elem)[source]
xlrd.xlsx.ensure_elementtree_imported(verbosity, logfile)[source]
xlrd.xlsx.get_text_from_si_or_is(self, elem, r_tag=u'{http://schemas.openxmlformats.org/spreadsheetml/2006/main}r', t_tag=u'{http://schemas.openxmlformats.org/spreadsheetml/2006/main}t')[source]

Returns unescaped unicode

xlrd.xlsx.make_name_access_maps(bk)[source]
xlrd.xlsx.map_attributes(amap, elem, obj)[source]
xlrd.xlsx.open_workbook_2007_xml(zf, component_names, logfile=<open file '<stdout>', mode 'w'>, verbosity=0, use_mmap=0, formatting_info=0, on_demand=0, ragged_rows=0)[source]
xlrd.xlsx.split_tag(tag)[source]
xlrd.xlsx.unescape(s, subber=<built-in method sub of _sre.SRE_Pattern object>, repl=<function <lambda>>)[source]

Module contents

xlrd.count_records(filename, outfile=<open file '<stdout>', mode 'w'>)[source]
xlrd.dump(filename, outfile=<open file '<stdout>', mode 'w'>, unnumbered=False)[source]
xlrd.open_workbook(filename=None, logfile=<open file '<stdout>', mode 'w'>, verbosity=0, use_mmap=1, file_contents=None, encoding_override=None, formatting_info=False, on_demand=False, ragged_rows=False)[source]