SosijElizabeth
SosijElizabeth

Reputation: 99

Using defined names with xlsx-populate

I'm currently trying to create defined names in excel using the node package xlsx-populate, and I'm using the docs here: https://github.com/dtjohnson/xlsx-populate#defined-names

I'm trying to give it a value which refers to a formula, like below, where each cell in the range AL3-AL14 refers to an item for sale, such as below

await workbook.definedName("Item").value("=ItemSheet!$AL$3:$AL$14")

When I try to run my code, I get the following error message:

Cannot read property 'value' of undefined

Any help would be greatly appreciated to point me in the right direction

Upvotes: 0

Views: 842

Answers (1)

SosijElizabeth
SosijElizabeth

Reputation: 99

Ok, I finally managed to find the issue.

Rather than assigning the formula to 'value', it goes in as the 2nd argument to the definedName method.

Also, and frustratingly this took me so long to work out, you don't need the '=' equals sign at the start of the formula, despite it appearing that way in excel.

So it will look something like this:

await workbook.definedName("Item", "ItemSheet!$AL$3:$AL$14")

Upvotes: 1

Related Questions