-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Thank you for writing this. I have recently moved from using csv files to excel files and this has made the transition easier.
One issue I have encountered is that empty cells are not being returned as a Falsey value like None, or the empty string ''.
From what I have been able to understand, openpyxl reads the empty cell as None, and the following code in sheet2dict uses str to convert this into the string 'None'.
Lines 30 to 34 in 93bf731
| def item(row, col): | |
| return ( | |
| sheet.cell(row=1, column=col).value, | |
| str(sheet.cell(row=row, column=col).value), | |
| ) |
I have filtered my own dictionaries to turn 'None' into '' but that will cause issues when any of my sheet really do contain the word None.
I just did some quick testing, and it seems that the csv.DictReader() in the python standard library uses the empty string '' for missing values in the a csv file, so that might be a good thing to do for these cases.