tafia / calamine

A pure Rust Excel/OpenDocument SpreadSheets file reader: rust on metal sheets
MIT License
1.6k stars 155 forks source link

Is there a way to get the "original value" of a cell that has an Error? #416

Closed jqnatividad closed 2 months ago

jqnatividad commented 3 months ago

For example, if there is a Div by Zero error in a cell, can I get the formula text (e.g. "=100/0") instead of "#DIV/0!"?

tafia commented 3 months ago

You can get the formula separately. There is no "simple" way to connect the 2 for now https://docs.rs/calamine/latest/calamine/enum.Sheets.html#method.worksheet_formula

jqnatividad commented 3 months ago

Thanks @tafia ! Just needed to be pointed in the right direction...

jqnatividad commented 3 months ago

I implemented retrieving the formula text per your suggestion to use worksheet_formula in combination with get_value.

https://github.com/jqnatividad/qsv/blob/master/src/cmd/excel.rs#L2 https://github.com/jqnatividad/qsv/pull/1721/files

And it works!

But interestingly, only on macOS, and not on Windows or Linux (or more specifically, the Windows and Linux Github Action Runners")

Very strange... any thoughts why it works on macOS but not other platforms?

GH Action runner on Linux: https://github.com/jqnatividad/qsv/actions/runs/8563583350/job/23468826400

On macOS: https://github.com/jqnatividad/qsv/actions/runs/8563583347/job/23468826402

jqnatividad commented 2 months ago

Closing this as it seems the problem is with GitHub's action runners.

When I run the tests locally on native hardware, they work as expected. It may be an issue with GH runners running on Azure VMs.