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
get_grid(**keywords) Get data in grid format
get_html(**keywords) Get data in html format
get_json(**keywords) Get data in json format
get_latex(**keywords) Get data in latex format
get_latex_booktabs(**keywords) Get data in latex_booktabs format
get_mediawiki(**keywords) Get data in mediawiki format
get_ods(**keywords) Get data in ods format
get_orgtbl(**keywords) Get data in orgtbl format
get_pipe(**keywords) Get data in pipe format
get_plain(**keywords) Get data in plain format
get_records(**keywords) Get data in records format
get_rst(**keywords) Get data in rst format
get_simple(**keywords) Get data in simple format
Book.get_svg
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(**keywords) 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])
load_from_sheets(sheets) Load content from existing sheets
number_of_sheets() Return the number of sheets
Book.plot
register_book_input(file_type) partial(func, *args, **keywords) - new function with partial application
register_io(file_type) partial(func, *args, **keywords) - new function with partial application
register_presentation(file_type[, ...]) partial(func, *args, **keywords) - new function with partial application
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
set_grid(content, **keywords) grid setter is not defined.
set_html(content, **keywords) html setter is not defined.
set_json(content, **keywords) json setter is not defined.
set_latex(content, **keywords) latex setter is not defined.
set_latex_booktabs(content, **keywords) latex_booktabs setter is not defined.
set_mediawiki(content, **keywords) mediawiki setter is not defined.
set_ods(content, **keywords) Set data in ods format
set_orgtbl(content, **keywords) orgtbl setter is not defined.
set_pipe(content, **keywords) pipe setter is not defined.
set_plain(content, **keywords) plain setter is not defined.
set_records(content, **keywords) Set data in records format
set_rst(content, **keywords) rst setter is not defined.
set_simple(content, **keywords) simple setter is not defined.
Book.set_svg
set_texttable(content, **keywords) 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
grid Get data in grid format
html Get data in html format
json Get data in json format
latex Get data in latex format
latex_booktabs Get data in latex_booktabs format
mediawiki Get data in mediawiki format
ods Get/Set data in/from ods format
orgtbl Get data in orgtbl format
pipe Get data in pipe format
plain Get data in plain format
records Get/Set data in/from records format
rst Get data in rst format
simple Get data in simple format
stream Return a stream in which the book content is properly encoded
Book.svg
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