comet.excel¶
The comet.excel module provides access to reading and writing Microsoft Excel files (.xlsx).
See also
- Class
CExcelBook
Opened Excel file with methods to fetch and write data.
Methods¶
- comet.excel.open(path, autoSave=False, useGlobal=True)¶
Open an Excel file.
- Parameters:
path (str) – The file path. May start with $ALIAS names.
autoSave (bool) – Should the file be saved automatically before closing?
useGlobal (bool) –
Open file globally or only for the current script?
True
Open file globally. The Excel file remains open until the current data connection is closed or a until call to
CExcelBook.close()
. If the file has already been opened in a previous script, this already opened file is returned. Since you probably want to use the file in multiple scripts, this is the recommended procedure.
False
: Open file only for the current script. In this case the received result of the function must be closed again withCExcelBook.close()
!
- Returns:
The opened file
- Return type:
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter path is empty
FileNotFoundError – When parameter path does not point to an existing file
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- See also:
- CScript:
- comet.excel.indexToColumn(index)¶
Conversion of a column number into the form A, B, …, Z, AA, AB, …, which is commonly used in Excel.
- comet.excel.columnToIndex(column)¶
Conversion of an Excel column name of the form A, B, …, Z, AA, AB, … …into an index number.
- Parameters:
column (str) –
String consisting of the letters A-Z and a-z.
Lower case letters are automatically evaluated as upper case letters.
Please note that Excel supports a maximum of 2^14 = 16.384 columns only.
This corresponds to the string ‘XFD’.
- Returns:
The index of the column
- Return type:
- Raises:
TypeError – When parameter types are invalid
- Available:
InDesign® comet_pdf® Illustrator®
- CScript: