trading_agent.attachments.excel_text_reader
¶
Reads an Excel workbook (.xlsx) with openpyxl: every sheet, one row per line, cells separated by tabs.
Formulas are read as the values Excel last calculated, which is what a person sees. The older .xls format is a different, binary format that openpyxl cannot open, so it is not accepted.
Typical usage example:
extracted = ExcelTextReader().read(Path('positions.xlsx'))
ExcelTextReader
¶
Bases: TextReader
Reads a .xlsx file.
read
¶
Reads every sheet under a heading with its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The workbook. |
required |
Returns:
| Type | Description |
|---|---|
ExtractedText
|
Its text. |
Raises:
| Type | Description |
|---|---|
TextReadError
|
The file is damaged or is not a .xlsx file. |