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

Option to output formulae to JSON #1370

Open
dandv opened this issue Nov 29, 2018 · 6 comments
Open

Option to output formulae to JSON #1370

dandv opened this issue Nov 29, 2018 · 6 comments

Comments

@dandv
Copy link

@dandv dandv commented Nov 29, 2018

I'm using .sheet_to_json for easier testing (instead of comparing the ws object with an expected one). The problem is that formula cells don't show up in the JSON output. Is there a way to make that happen (other than sheet_to_formulae)? If not, an option like formulas: true for sheet_to_json would be very useful for test automation.

@leostar-eva
Copy link

@leostar-eva leostar-eva commented Oct 14, 2019

I also met the same problem. Has this problem been solved?

@SheetJSDev
Copy link

@SheetJSDev SheetJSDev commented Jan 18, 2020

Sure, how would you handle cells that have a raw value (like a number or raw string)?

@dandv
Copy link
Author

@dandv dandv commented Jan 22, 2020

It's been a while since I filed this issue do I don't remember the entire context, but if I understand the question correctly, it's about deciding between outputting the raw value and the formula of a cell, in case both exists?

In that case, I would prefer the formula to be output, since the raw value represents a particular calculation for the formula at a point in time.

@SheetJSDev
Copy link

@SheetJSDev SheetJSDev commented Jan 22, 2020

For cells that have formula expressions and values, you clearly would return the formula. The question is about cells that just have a value (no associated formula expression).

Currently the formula output utility function guesses based on the type of cell. Numeric cell values are stringified, and string cell values are prepended with a single quote (how it would appear in the formula bar if you entered the value manually)

@dandv
Copy link
Author

@dandv dandv commented Jan 22, 2020

I think that's a good solution.

(Naively, I would like the values coerced to Number or String according to the cell type, but then you'd have to distinguish between literal strings starting with the = sign, and formulas.)

@Himanshu032000
Copy link

@Himanshu032000 Himanshu032000 commented Oct 21, 2021

@SheetJSDev Can I take this issue?

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

No branches or pull requests

4 participants