From a059ad1626774e9e1e151cd620e35cab9d37c184 Mon Sep 17 00:00:00 2001 From: VivekGhantiwala Date: Wed, 11 Mar 2026 16:00:27 +0530 Subject: [PATCH] Fix float parsing of ISO section codes like 5.10 Replace get_all_records() with get_all_values() to bypass gspread's numericise() which converts section codes like '5.10' to float 5.1. get_all_values() returns raw strings, preserving trailing zeros. Fixes #574 Fixes #546 --- application/utils/spreadsheet.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/application/utils/spreadsheet.py b/application/utils/spreadsheet.py index b18b493dd..855d0136e 100644 --- a/application/utils/spreadsheet.py +++ b/application/utils/spreadsheet.py @@ -58,21 +58,15 @@ def read_spreadsheet( "(remember, only numbered worksheets" " will be processed by convention)" % wsh.title ) - records = wsh.get_all_records( - head=1, - numericise_ignore=list( - range(1, wsh.col_count) - ), # Added numericise_ignore parameter - ) # workaround because of https://github.com/burnash/gspread/issues/1007 # this will break if the column names are in any other line + rows = wsh.get_all_values() + headers = rows[0] + records = [dict(zip(headers, row)) for row in rows[1:]] toyaml = yaml.safe_load(yaml.safe_dump(records)) result[wsh.title] = toyaml elif not parse_numbered_only: - records = wsh.get_all_records( - head=1, - numericise_ignore=list( - range(1, wsh.col_count) - ), # Added numericise_ignore parameter -- DO NOT make this 'all', gspread has a bug - ) # workaround because of https://github.com/burnash/gspread/issues/1007 # this will break if the column names are in any other line + rows = wsh.get_all_values() + headers = rows[0] + records = [dict(zip(headers, row)) for row in rows[1:]] toyaml = yaml.safe_load(yaml.safe_dump(records)) result[wsh.title] = toyaml except gspread.exceptions.APIError as ae: