1
The library sheet js. allows the creation and editing of spreadsheets of the type xlsx
d Open office
. Currently I have a spreadsheet that contains 3 pages as shown in the figure below.
The page DADOS
contains information that will be used by the pages Gráfico 1
and Gráfico 2
.
The page Gráfico 1
contains a formatting that displays in graphic form the data contained in the page DADOS
, in addition to containing math accounts working with the page DADOS
ex. =DADOS.A1/Gráfico1.B2
.
To edit a spreadsheet using sheet.js and used the following code.
if(typeof require !== 'undefined') XLSX = require('xlsx');
var workbook = XLSX.readFile('test.xlsx');
/* o workbook representa tudo no arquivo XLSX */
// Através da variavel workbook eu consigo ter
// controle de paginas, linhas, colunas e etc
XLSX.writeFile(workbook, 'out.xlsx');
Note that in the code I use the command XLSX.writeFile(workbook, 'out.xlsx');
to generate a new file xlsx
that in theory should have nothing other than the spreadsheet test.xlsx
from which it originates.
The problem I am facing is that when a new file is generated it loses the formulas contained in the original spreadsheet cells, on the page Gráfico 1
where the formula was =DADOS.A1/Gráfico1.B2
has only the result of the formula, when clicking on the cell to edit does not appear the same formula in the original spreadsheet, and any formatting that the spreadsheet contains and lost.
I need help to save this spreadsheet and keep the formulas and formatting contained in the original.