Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
How do you put a value in a similar key over and over again in javascript

I want to receive the Excel data and put the value in the Excel column as a loop statement.

I want to put it in with the code below, what should I do?


//read file
const workbook = XLSX.readFile("test.xlsx");

//put value
workbook.Sheets.Sheet1.B2.v = 2000
workbook.Sheets.Sheet1.B3.v = 3000
workbook.Sheets.Sheet1.B4.v = 4000
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use bracket notations along with a for loop to do this.

With [] notation, you can use a variable to access a property of an object.

Initialize with a suitable value and run up til some limit. Here is sample code:

const workbook = XLSX.readFile("test.xlsx");
let cellsLimit = 100;
for(let i = 1 ; i <= cellsLimit; i++){
let keyName = 'B' + i;
workbook.Sheets.Sheet1[keyName].v = 1000 + (i*1000)
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!