excel4node
excel4node copied to clipboard
Comparing cell values?
I have an array var names = ["Bill", "Bill", "Bill"];
and I have creating the cells through a for loop
for(var i = 0; i < names.length; i++) {
ws.cell(2 + i, 1).string(name[i]);
}
and if I try to do a basic comparison like
if(ws.cell(2 + i, 1).string(name[i]) == ws.cell(2 + i, 1).string(name[i])) {
console.log(true)
}
It doesnt work, my goal is to combine the cells together if they are equal so this would end up being
ws.cell(2,1,4,1,true).string(name[i]);
so it wont be combined 3 cells here. Is there a way I can compare the cell values?
I know in this example, I could do it without comparing but it is a more crucial in other ways for me
ws.cell(x,y).string("")
method is meant for storing data in the cells, not reading from the cells. So you need to compare values first, and then store them in properly formatted/merged cell.
Can we close the issue?
Yes