question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Formulae not retained on export

See original GitHub issue

When a worksheet has cells with valid .f properties (formula), the value is not retained during exporting to XLSX format via:

var workbook = workbook = Xlsx.readFile('OnDemand.xlsx', { 
    cellFormula: true, 
    cellStyles: true, 
    sheetStubs: true, 
    cellNF: true, 
    bookDeps: true 
});
var out = Xlsx.write( workbook, { bookType: 'xlsx', /*bookSST: true,*/ type: 'binary' });

I need to support such functionality for the modification of templated workbooks. For example, the template has a cell, Q16 with the formula =IF(ISERROR((N16*M16*R16)/101.8),0,((N16*M16*R16)/101.8)). When output via the above code, the value “0” is produced instead.

No formula information is retained, and the cell is a “General” cell of value “0”. Is there a workaround or solution to this?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
ngehlertcommented, May 13, 2016

any update on when formulas will be supported or at least the xlsx patch from @mcsf will be merged?

0reactions
SheetJSDevcommented, Mar 18, 2017

We finally settled on a convention: for non-array formulae just setting the f key will export the formula. For array formulae, set the topleft corner cell’s F key to the array formula range. This works for range as well as point array formulae.

We updated the write test with an example

Read more comments on GitHub >

github_iconTop Results From Across the Web

Formulas are not working after exporting to Excel
Answer: · Open the exported report file in Microsoft Excel. · Highlight the column in which to use the formula. · Select Data,...
Read more >
Excel formatting and features that are not transferred to other ...
To preserve the formulas if you reopen the file in Excel, select the Delimited option in the Text Import Wizard, and select tab...
Read more >
Keep formulas when export Excel- FineReport Help Document
1) Save the report, click the pagination preview, and after querying the data, click Export button in the toolbar, and choose Unaltered Export...
Read more >
Excel exports / copies don't retain formulas - Adagio Accounting ...
When I export anything to Excel the formulas all stay, but then when I try to copy that spreadsheet anywhere I get an...
Read more >
My export to excel is not retaining the designated column ...
Hi, I've created an excel sheet that contains numeric values and monetary values. Initially, whenever I export the data to a .xlsx file....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found