reader.worksheet.fast_parse sets booleans to integers

Issue #86 resolved
Former user created an issue

When using reader.worksheet.fast_parse booleans turn into integers. It would be better if those were of Python boolean type.

Simple fix would be to do something like this:



if data_type == Cell.TYPE_BOOL: value = bool(int(value)) }}}

Comments (9)

  1. CharlieC

    Does this problem still exist? The parser defers this to the Cell which looks at a cursory glance to use Python booleans. If this is not the case, please provide an example.

  2. George Vilches

    It's still a problem with the newest version of the codebase. I have a worksheet with booleans in it, and they are coming out as ints.

    In parse_cell, I added lines 135 and 136 to stop the boolean from being read in as an int:

               if data_type == Cell.TYPE_STRING:
                    value = self.string_table.get(int(value))
                elif data_type == Cell.TYPE_BOOL:
                    value = bool(int(value))
                if formula is not None and not self.data_only:

    I unfortunately cannot attach the worksheet here, but if you cannot replicate, I will try to make a trimmed down version of the sheet. Any boolean should trip it.

  3. Log in to comment