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

Set string type attribute correctly for formula values #122

Closed
jkyeung opened this issue May 21, 2014 · 2 comments
Closed

Set string type attribute correctly for formula values #122

jkyeung opened this issue May 21, 2014 · 2 comments
Assignees
Labels
bug

Comments

@jkyeung
Copy link
Contributor

@jkyeung jkyeung commented May 21, 2014

When attempting to write both a formula and a value to the same cell, the value is currently "type-checked" using float() (see Worksheet._write_cell). So strings that happen to look like numbers get treated as numbers, just like what used to happen for cells that don't contain formulas.

I believe the proper fix is to determine str_types (like what was done for Worksheet.write) and then do

if isinstance(cell.value, str_types):
    attributes.append(('t', 'str'))

I don't know the best way to set and access str_types for speed. One naive guess would be to assign it at the module level, like for the various "cell_blah_tuple" named tuples.

@jmcnamara jmcnamara self-assigned this May 21, 2014
@jmcnamara jmcnamara added the bug label May 21, 2014
@jmcnamara
Copy link
Owner

@jmcnamara jmcnamara commented May 21, 2014

@jkyeung, Thanks for that. I'll put in a fix for it.

jmcnamara added a commit that referenced this issue Jul 22, 2014
@jmcnamara
Copy link
Owner

@jmcnamara jmcnamara commented Jul 22, 2014

Fixed in version 0.5.6. Thanks.

John

@jmcnamara jmcnamara closed this Jul 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.