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

451
Views
Read Empty Cells node.js xlsx

I am using the node.js package xlsx to access an xlsx file using the following code:

const XLSX = require("xlsx")

wbInput.addEventListener("change", (evt) => {
    if (wbInput.files.length === 0)
      return;
  
    actOnXLSX(wbInput.files[0]);
  }, false);
  
  
  async function actOnXLSX (file) {
    const fileReader = new FileReader();
  
    const data = await new Promise((resolve, reject) => {
        fileReader.onload = () => {
          resolve(fileReader.result);
        };
        fileReader.onerror = reject;
  
        fileReader.readAsArrayBuffer(file);
      })
      .finally(() => {
        fileReader.onerror = fileReader.onload = null;
      });
  
    const workbook = XLSX.read(data);
    const worksheet = workbook.Sheets[workbook.SheetNames[0]];
    console.log(worksheet)
    
    var columnA = []

    for (let z in worksheet) {
        if(z.toString()[0] === 'A'){
          columnA.push(worksheet[z].v);
        }
      }
      
    console.log(columnA);

    for (let i= 1; i < columnA.length; i++) {
        console.log(columnA[i], i)
    }
}

This works fine for when all the cells between the first and the end cell contain data, but when there is an empty cell the array skips it instead of storing it as an empty entry. Is it possible for it to store when there are empty codes? I will be using i to simultaneously write to a spreadsheet using another function so the array always needs to remain true to the spreadsheet it is reading.

about 4 years ago · Juan Pablo Isaza
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!