Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_workbook with data_only=True by default #38

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Each object in the 'tables' array describes one or more CSV or Excel spreadsheet
- **prefer_schema_as_string**: (optional) Bool value either as true or false (default). Should the schema be all read as string by default.
- **selected**: (optional) Should this table be synced. Defaults to true. Setting to false will skip this table on a sync run.
- **worksheet_name**: (optional) the worksheet name to pull from in the targeted xls file(s). Only required when format is excel
- **data_only**: (optional) Bool value either as true (default) or false. When enabled, get the latest value computed by Excel instead of the formula. Only required when format is Excel
- **delimiter**: (optional) the delimiter to use when format is 'csv'. Defaults to a comma ',' but you can set delimiter to 'detect' to leverage the csv "Sniffer" for auto-detecting delimiter.
- **quotechar**: (optional) the character used to surround values that may contain delimiters - defaults to a double quote '"'
- **json_path**: (optional) the JSON key under which the list of objets to use is located. Defaults to None, corresponding to an array at the top level of the JSON tree.
Expand Down
1 change: 1 addition & 0 deletions tap_spreadsheets_anywhere/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
Optional('field_names'): [str],
Optional('search_prefix'): str,
Optional('worksheet_name'): str,
Optional('data_only'): bool,
Optional('delimiter'): str,
Optional('quotechar'): str,
Optional('json_path'): str,
Expand Down
3 changes: 2 additions & 1 deletion tap_spreadsheets_anywhere/excel_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def get_legacy_row_iterator(table_spec, file_handle):


def get_row_iterator(table_spec, file_handle):
workbook = openpyxl.load_workbook(file_handle, read_only=True)
data_only = table_spec.get("data_only", True)
workbook = openpyxl.load_workbook(file_handle, read_only=True, data_only=data_only)

if "worksheet_name" in table_spec:
try:
Expand Down