excel4node icon indicating copy to clipboard operation
excel4node copied to clipboard

Formula not working

Open ilijaveselica opened this issue 8 years ago • 12 comments

Formula doesn't work. It's printed in the formula field but it's not applied.

// Require library 
var xl = require('excel4node');
 
// Create a new instance of a Workbook class 
var wb = new xl.Workbook();
 
// Add Worksheets to the workbook 
var ws = wb.addWorksheet('Sheet 1');
 
// Create a reusable style 
var style = wb.createStyle({
    font: {
        color: '#FF0800',
        size: 12
    },
    numberFormat: '$#,##0.00; ($#,##0.00); -'
});

ws.cell(1,1).number(100).style(style);
ws.cell(2,1).number(95).style(style);
ws.cell(3,1).number(23).style(style);
ws.cell(4,1).number(7).style(style);
ws.cell(5,1).number(56).style(style);
ws.cell(6,1).number(4).style(style);
ws.cell(7,1).number(75).style(style);
 
// Doesn't work in Microsoft Excel, works in LibreOffice
ws.cell(1,3).formula('SUM(A1:A7)').style(style);
  
wb.write('Excel2.xlsx');

I've tried few Excel packages and all have the same issue so far.

ilijaveselica avatar Nov 24 '16 10:11 ilijaveselica

ilijaveselica: I just tried your code above without the styles and it seems to be working just fine.

absarora avatar Nov 29 '16 21:11 absarora

I am having the same issue - without styles

calumk avatar Feb 23 '17 11:02 calumk

I am having the same issue - after clicking in the row the formula works - but initially #NAME? will be displayed

deepsoul avatar Oct 18 '17 17:10 deepsoul

Hi, is there any progress in this issue?

deepsoul avatar Mar 28 '18 14:03 deepsoul

For me, the problem now seems to be solved - I wonder if updating excel solves it?

calumk avatar Mar 28 '18 17:03 calumk

I'm not sure if that's the same issue, but my formulas don't get evaluated if excel opens the file in "protected view" (after downloading it from the internet)

there's similar issue described here, of course it's a different software, but maybe there's some hint: https://www.syncfusion.com/forums/109560/formulas-in-excel-spreadsheet-do-not-calculate-until-enable-editing-is-clicked they suggested using something like sheet.EnableSheetCalculations(); - is there something like that available in excel4node api?

reg0 avatar Apr 05 '18 07:04 reg0

I have the same issue with the formulas, specifically with IF and SUMPRODUCT. They have in common the use of ";" inside the formula, maybe it is related to that. The formula won't be evaluated.

mlanzi avatar Apr 12 '18 16:04 mlanzi

@reg0 sheet calculations are turned on by default. @ilijaveselica, does this issue only occur when downloading the excel file from the internet and opening with Excel for Windows? If so, that is a security feature of Windows Excel. I don't believe it can be overridden.

natergj avatar Apr 23 '18 23:04 natergj

I found how to resolve my issue: the string of the formula cannot contain ";" I replaced the ";" with "," and not it works!

mlanzi avatar Apr 24 '18 07:04 mlanzi

Somehow im trying to use the formula "SUMA(F1:FX)" but i get suma(f1:fx) and libreoffice does not resolve the formula :(

Dont want to manually touch the library, but this should be fixed

biaggi avatar Aug 31 '19 14:08 biaggi

@biaggi you need to put SUM instead of SUMA because excel4node works with formulas in English. Regards

mmartinsolisdev avatar Nov 23 '19 17:11 mmartinsolisdev

I'm not sure if that's the same issue, but my formulas don't get evaluated if excel opens the file in "protected view" (after downloading it from the internet)

there's similar issue described here, of course it's a different software, but maybe there's some hint: https://www.syncfusion.com/forums/109560/formulas-in-excel-spreadsheet-do-not-calculate-until-enable-editing-is-clicked they suggested using something like sheet.EnableSheetCalculations(); - is there something like that available in excel4node api?

having same issue is there any solution for excel4node package

ghost avatar May 11 '22 13:05 ghost