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

Boolean cell with value ="true" is returned as 1 #278

Closed
nehakseth opened this issue Mar 9, 2017 · 2 comments
Closed

Boolean cell with value ="true" is returned as 1 #278

nehakseth opened this issue Mar 9, 2017 · 2 comments

Comments

@nehakseth
Copy link

There is not difference between a boolean cell and a normal text cell.

If i have 2 cells , on with value = "1" and another with value="True" then while reading excel the cell.value function returns 1 for both of them. What is the correct way to read the text "True" from a cell?

@guyonroche
Copy link
Collaborator

This is interesting - I hadn't accounted for boolean values when I first wrote this lib but I can see what is going on...
When you type "True" or "False" into a cell in Excel, it interprets that as a boolean truth value and records the value 1 and 0 in the saved document. It's presented in the UI as "TRUE" and "FALSE" (or some other culturally aware text) but underneath it is 1 and 0.
I will have to add bools - as reading and then writing the spreadsheet will lose the 'bool-ness' though the truthy-ness will be preserved.
For the time-being, when you read a spreadsheet with bools, you can trust the truthyness of the value but for now you will need to translate the text into "true" and "false" yourself.

For the record, I will use the JS values true and false for the cell values (to distinguish from 0 and 1 as numbers) and the .text value will be "true" and "false".

@guyonroche
Copy link
Collaborator

@nehakseth - just published 0.4.0 which includes support for boolean (and error) values.
Bools will now be true or false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants