pyexcel.Book

class pyexcel.Book(sheets=None, filename='memory', path=None)[source]

Read an excel book that has one or more sheets

For csv file, there will be just one sheet

__init__(sheets=None, filename='memory', path=None)[source]

Book constructor

Selecting a specific book according to filename extension

Parameters:
  • sheets – a dictionary of data
  • filename – the physical file
  • path – the relative path or absolute path
  • keywords – additional parameters to be passed on

Methods

__init__([sheets, filename, path]) Book constructor
get_array(**keywords) Get data in array format
get_bookdict(**keywords) Get data in bookdict format
get_csv(**keywords) Get data in csv format
get_csvz(**keywords) Get data in csvz format
get_dict(**keywords) Get data in dict format
Book.get_echarts_html
get_fods(**__) fods getter is not defined.
Book.get_gantt_html
Book.get_grid
get_handsontable_html(**keywords) Get data in handsontable.html format
Book.get_html
Book.get_json
Book.get_latex
Book.get_latex_booktabs
Book.get_mediawiki
Book.get_ndjson
get_ods(**keywords) Get data in ods format
Book.get_orgtbl
Book.get_pdf
Book.get_pipe
Book.get_plain
get_records(**keywords) Get data in records format
Book.get_rst
Book.get_simple
Book.get_sortable_html
get_svg(**keywords) Get data in svg format
get_texttable(**keywords) Get data in texttable format
get_tsv(**keywords) Get data in tsv format
get_tsvz(**keywords) Get data in tsvz format
get_url(**__) url getter is not defined.
get_xls(**keywords) Get data in xls format
get_xlsm(**keywords) Get data in xlsm format
get_xlsx(**keywords) Get data in xlsx format
init([sheets, filename, path]) indpendent function so that it could be called multiple times
load_from_sheets(sheets) Load content from existing sheets
number_of_sheets() Return the number of sheets
register_input(file_type) partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.
register_io(file_type) partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.
register_presentation(file_type[, …]) partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.
remove_sheet(sheet) Remove a sheet
save_as(filename, **keywords) Save the content to a new file
save_to_database(session, tables[, …]) Save data in sheets to database tables
save_to_django_models(models[, …]) Save to database table through django model
save_to_memory(file_type[, stream]) Save the content to a memory stream
set_array(content, **keywords) Set data in array format
set_bookdict(content, **keywords) Set data in bookdict format
set_csv(content, **keywords) Set data in csv format
set_csvz(content, **keywords) Set data in csvz format
set_dict(content, **keywords) Set data in dict format
Book.set_echarts_html
set_fods(content, **keywords) Set data in fods format
Book.set_gantt_html
Book.set_grid
set_handsontable_html(_y, **_z) handsontable.html setter is not defined.
Book.set_html
Book.set_json
Book.set_latex
Book.set_latex_booktabs
Book.set_mediawiki
Book.set_ndjson
set_ods(content, **keywords) Set data in ods format
Book.set_orgtbl
Book.set_pdf
Book.set_pipe
Book.set_plain
set_records(content, **keywords) Set data in records format
Book.set_rst
Book.set_simple
Book.set_sortable_html
set_svg(_y, **_z) svg setter is not defined.
set_texttable(_y, **_z) texttable setter is not defined.
set_tsv(content, **keywords) Set data in tsv format
set_tsvz(content, **keywords) Set data in tsvz format
set_url(content, **keywords) Set data in url format
set_xls(content, **keywords) Set data in xls format
set_xlsm(content, **keywords) Set data in xlsm format
set_xlsx(content, **keywords) Set data in xlsx format
sheet_by_index(index) Get the sheet with the specified index
sheet_by_name(name) Get the sheet with the specified name
sheet_names() Return all sheet names
to_dict() Convert the book to a dictionary

Attributes

array Get/Set data in/from array format
bookdict Get/Set data in/from bookdict format
csv Get/Set data in/from csv format
csvz Get/Set data in/from csvz format
dict Get/Set data in/from dict format
Book.echarts_html
fods Set data in fods format
Book.gantt_html
Book.grid
handsontable_html Get data in handsontable.html format
Book.html
Book.json
Book.latex
Book.latex_booktabs
Book.mediawiki
Book.ndjson
ods Get/Set data in/from ods format
Book.orgtbl
Book.pdf
Book.pipe
Book.plain
plot([file_type]) Visualize the data
records Get/Set data in/from records format
Book.rst
Book.simple
Book.sortable_html
stream Return a stream in which the content is properly encoded
svg Get data in svg format
texttable Get data in texttable format
tsv Get/Set data in/from tsv format
tsvz Get/Set data in/from tsvz format
url Set data in url format
xls Get/Set data in/from xls format
xlsm Get/Set data in/from xlsm format
xlsx Get/Set data in/from xlsx format