2

I'm using xlsxwriter to create my excel file data.xlsx. The file contain some cell with formula:

for example: =73-B2

Then I make a xhr query to read that data.xlsx by pandas (from django)

pd.read_excel('data.xlsx','sheet_name="dn")

However the first time read that file, value of the cell contains formula can't be get, except I manually open data.xlsx, save it.. then got the value.

I found related question but there is not a solution

malberts
  • 2,488
  • 1
  • 11
  • 16
xuke
  • 45
  • 7
  • I think someone posted the answer [here](https://stackoverflow.com/questions/42102674/how-can-i-see-the-formulas-of-an-excel-spreadsheet-in-pandas-python) is this helping? – nickyfot Feb 20 '19 at 12:20
  • This is explained in the XlsxWriter docs and the FAQ: [Q. Why do my formulas show a zero result in some, non-Excel applications?](https://xlsxwriter.readthedocs.io/faq.html). Basically, XlsxWriter doesn't evaluate a formula or write the result (apart from a default result of 0). So you cannot create a formula with XlsxWriter and then read the result back out. You should either evaluate the formula you want in Python or use one of the Python modules that automates Excel like xlwings. – jmcnamara Feb 20 '19 at 17:27
  • @nickthefreak thank you but isn't the answer i'm looking for – xuke Feb 21 '19 at 02:42
  • @jmcnamara thank you, I got it, so I try to evaluate values rather than the formula and It works – xuke Feb 21 '19 at 02:43

0 Answers0