0

So, the problem is this:

I'm using excel4node to create and write on excel. My question is this: Let's say cell (1,1) and (1,2) are two numbers. I would like to programmatically create a third cell that is the sum of both numbers.

Example: if cell (1,1) contains 10 and cell (1,2) contains 20, then cell (1,3) should contain 30 (thanks @BruceWayne)

Also, both numbers are allowed to be modified and the third cell should always change to reflect the sum of the first two. How can i do so programmatically ? Thanks.

1 Answers1

0

How do you want this to be implemented? If you implement via cell formula, then why not just do:

ws.cell(1,3).formula('=SUM(A1+A2)');

However, this is hardcoding the cells into the formula. Do you also want to use the excel4node library for that part as well? I think it would be something like:

ws.cell(1,3).formula('=SUM(' + XL.getExcelCellRef(1,1) + '+' + XL.getExcelCellRef(1,2) + ')');

But you have not specified how much you want to 'programmatically create'... Were you looking for something else?

SeanyD
  • 1
  • 3