mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #149] Writing formulas on xlsx files #123
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#123
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @HenriqueMisael on GitHub (Mar 8, 2018).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/149
Originally assigned to: @jmcnamara on GitHub.
In excel,
When you write it shows up in the cell
A2+A3 A2+A3
=A2+A3 the result of the sum
'=A2+A3 =A2+A3
Knowing that, I've tried to write "=A2+A3" using the write_string function, but it wrote just the formula, not showing up the result. Once I select the cell and press ENTER, however, the cell turned to the result of the formula I entered.
Looking deep in the xlsx file I've figured out that
<c></c>, with the attributes "r" for identification (A3, B6, etc).<v></v>of the cell. For identify this is a reference for sharedStrings.xml and not the actually value of the cell, a attribute "t" of the cell it suppled with "s" (<c r=X9 t="s"></c>).<f></f>, and the string equivalent to the formula is writen in it.Example: if I wrote "=A2+A3" in the cell A1, the tag for it will be something like
<c r=A1><f>A2+A3</f><v>698</v></c>, considering the result of the formula would be 698.I have not found any method to write a formula using libxlsxwriter. It would be really useful (I thought I will found this pointed out in Issues, and not finding it suprised me).
@jmcnamara commented on GitHub (Mar 8, 2018):
What about the
worksheet_write_formula()function?: https://libxlsxwriter.github.io/worksheet_8h.html#ae57117f04c82bef29805ec3eabc219bb@HenriqueMisael commented on GitHub (Mar 8, 2018):
I searched in the examples, sorry for the bad reporting
@jmcnamara commented on GitHub (Mar 8, 2018):
No problem. Closing.