simple_excel_writer
simple_excel_writer copied to clipboard
Text cells beginning with "=" cannot be created
As far as I can tell, there is currently no way to create a string CellValue that starts with "=" via the API, because such cells will always be interpreted as formulas. A more robust api would be requiring some explicit constructor or function call for formulas, rather than overloading strings for both text content and formulas.
For example,
row!["=A1+B1", "A1+B1"]
could become
row!["A1+B1", formula("A1 + B1") ]
The downside of this, is of course that it would be a breaking API change.
An alternative might be to keep the !row macro working as now, and just change the Row::add_cell API to always treat String as String and add a Formula type, or even to keep that API as well, but add a new function like Row::add_cell_strict. If necessary the row! macro could grow some tag to explicitly disambiguate strings (potentially) starting with "=".
Assuming the above is not mistaken I'd be happy to work on a PR that implements one of these strategies.