pyexcel.save_book_as

pyexcel.save_book_as(**keywords)[source]

Save a book from a data source to another one

Here is a table of parameters:

source parameters
loading from file file_name, keywords
loading from string file_content, file_type, keywords
loading from stream file_stream, file_type, keywords
loading from sql session, tables
loading from django models models
loading from dictionary bookdict
loading from an url url

Where the dictionary should have text as keys and two dimensional array as values.

Parameters

file_name :
a file with supported file extension
file_content :
the file content
file_stream :
the file stream
file_type :
the file type in file_content or file_stream
session :
database session
tables :
a list of database table
models :
a list of django models
bookdict :
a dictionary of two dimensional arrays
url :
a download http url for your excel file
sheets:
a list of mixed sheet names and sheet indices to be read. This is done to keep Pandas compactibility. With this parameter, more than one sheet can be read and you have the control to read the sheets of your interest instead of all available sheets.
auto_detect_float :
defaults to True
auto_detect_int :
defaults to True
auto_detect_datetime :
defaults to True
ignore_infinity :
defaults to True
library :
choose a specific pyexcel-io plugin for reading
source_library :
choose a specific data source plugin for reading
parser_library :
choose a pyexcel parser plugin for reading
skip_hidden_sheets:
default is True. Please toggle it to read hidden sheets

Parameters related to csv file format

for csv, fmtparams are accepted

delimiter :
field separator
lineterminator :
line terminator
encoding:
csv specific. Specify the file encoding the csv file. For example: encoding=’latin1’. Especially, encoding=’utf-8-sig’ would add utf 8 bom header if used in renderer, or would parse a csv with utf brom header used in parser.
escapechar :
A one-character string used by the writer to escape the delimiter if quoting is set to QUOTE_NONE and the quotechar if doublequote is False.
quotechar :
A one-character string used to quote fields containing special characters, such as the delimiter or quotechar, or which contain new-line characters. It defaults to ‘”’
quoting :
Controls when quotes should be generated by the writer and recognised by the reader. It can take on any of the QUOTE_* constants (see section Module Contents) and defaults to QUOTE_MINIMAL.
skipinitialspace :
When True, whitespace immediately following the delimiter is ignored. The default is False.
pep_0515_off :
When True in python version 3.6, PEP-0515 is turned on. The default is False
dest_file_name:
another file name.
dest_file_type:
this is needed if you want to save to memory
dest_session :
the target database session
dest_tables :
the list of target destination tables
dest_models :
the list of target destination django models
dest_mapdicts :
a list of mapping dictionaries
dest_initializers :
table initialization functions
dest_mapdicts :
to nominate a model or table fields. Optional
dest_batch_size :
batch creation size. Optional

Where the dictionary should have text as keys and two dimensional array as values.

Saving to source parameters
file dest_file_name, dest_sheet_name, keywords with prefix ‘dest’
memory dest_file_type, dest_content, dest_sheet_name, keywords with prefix ‘dest’
sql dest_session, dest_tables, dest_table_init_func, dest_mapdict
django model dest_models, dest_initializers, dest_mapdict, dest_batch_size