pylightxl
pylightxl copied to clipboard
Problem with saving bool data.
Pylightxl Version: Direct from github latest version as of 8/31 Python Version: 3.10.3
Summary of Bug/Feature:
Boolean cell data is apparently not supported.
If I modify the sample code "Write a new Excel From Python Data"
to use boolean values instead of int"
mydata: list[bool] = [True, False, True, False]
the file is written out but later the same code can no longer read the xlsx file.
Traceback:
File "C:\Users/Tim/Documents/rtms/Fusion360AddIns/LuthierTools\lib\rtms\Deserializer.py", line 36, in init self.db: Database = xl.readxl(fn=full_file_name) File "C:\Users/Tim/Documents/rtms/Fusion360AddIns/LuthierTools\lib\pylightxl\pylightxl.py", line 155, in readxl data = readxl_scrape(fn, fn_ws, sharedString, styles, comments) File "C:\Users/Tim/Documents/rtms/Fusion360AddIns/LuthierTools\lib\pylightxl\pylightxl.py", line 540, in readxl_scrape cell_val = float(cell_val)
I suppose I could just require a 1 or 0 in my code but that would detract from the value of allowing normal use of Excel to edit files.
Suggestion for fix:
Handle boolean data? Maybe change the documentation to indicate that not all valid Excel data types are allowed? Throw an exception when illegal data is sent in? Convert illegal types using str()?