pyexcel.save_book_as

pyexcel.save_book_as(**keywords)[source]

Save a book from a data source to another one

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 content
  • 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
  • dest_file_name – another file name. out_file is deprecated though is still accepted.
  • 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
  • keywords – additional keywords can be found at pyexcel.get_book()
Returns:

IO stream if saving to memory. None otherwise

see also A list of supported data structures

Here is a table of parameters:

source parameters
loading from file file_name, keywords
loading from memory file_type, content, 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.

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