json-as-xlsx
json-as-xlsx copied to clipboard
Using functions such as SUM
Hi
Thanks for the great project
Is there any way to use functions such as SUM?
If i use this =SUM(C2:C6) as a value it only shows as a string
Thanks
Hello,
It's not currently supported, but probably you can get something working by modifying the workbook using a callback
The callback is called just before writing the file
https://github.com/LuisEnMarroquin/json-as-xlsx/blob/6fe347612f8e3036bcf30aa2a8f019de41e216f6/src/index.ts#L146-L158
So you would need to do something similar to the 'format' code, but instead of writing to 'z', you would need to write to 'f'
https://github.com/LuisEnMarroquin/json-as-xlsx/blob/6fe347612f8e3036bcf30aa2a8f019de41e216f6/src/index.ts#L35-L56
Here is an example from SheetJs
https://github.com/SheetJS/sheetjs/issues/1123#issuecomment-392563798
As @elyse0 pointed same result can be archieved by processing with JS before writting the file