atomica.excel.copy_sheet

atomica.excel.copy_sheet(source, sheet_name, workbook)[source]

Copy a sheet into a Workbook

This function allows values to be copied from a file into a Workbook. The main use case is to support custom sheets in databooks that are not otherwise parsed but which might need to be retained. In particular, the ProjectData class does not parse ignored sheets at all, because no guarantees can be made about the quantity and type of the content, and whether there are formulas etc. that would be lost. In some cases though, it may be necessary to edit the databook and preserve specific sheets. In general, this can be done by using the to_workbook() method and then manually performing whatever operations are necessary to preserve the content on the extra sheets. However, when the extra sheet content is extremely simple e.g. just a table of values, then this helper function can be used to facilitate copying the content.

Warning - note that Excel functions, formatting, and comments will NOT be preserved.

Parameters:
  • source (str) – File name of the spreadsheet to read the source sheet from or an sc.Spreadsheet instance

  • sheet_name (str) – Name of the sheet to write to

  • workbook (Workbook) – A Workbook instance to add the sheet to

Return type:

None

Returns:

None - the sheet will be added to the Workbook in-place