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

386
Views
How to get the Column Data of an Excel Sheet by Column header name in JavaScript?

I have an Excel sheet like this.

Name Email Phone Number Address
A abc 001 USA
B abf 002 CAN
C abe 003 CHI
D abd 004 UK

And a Dropdown list on an HTML page like this

  • Name
  • Email
  • Address

What I want when a user clicks on any of the items in the list box e.g on the Name Only The values from the name column should be fetched and converted into the JSON object.

I have tried this solution but I don't know how to specify the column name in the code.

  var selectedFile;
        document
            .getElementById("fileUpload")
            .addEventListener("change", function (event) {
                selectedFile = event.target.files[0];
            });
        document
            .getElementById("uploadExcel")
            .addEventListener("click", function () {
                if (selectedFile) {
                    var fileReader = new FileReader();
                    fileReader.onload = function (event) {
                        var data = event.target.result;

                        var workbook = XLSX.read(data, {
                            type: "binary"
                        });
                        workbook.SheetNames.forEach(sheet => {
                            let rowObject = XLSX.utils.sheet_to_row_object_array(
                                workbook.Sheets[sheet]
                            );

                            let jsonObject = JSON.stringify(rowObject);
                            document.getElementById("jsonData").innerHTML = jsonObject;
                            console.log(jsonObject);
                        });
                    };
                    fileReader.readAsBinaryString(selectedFile);
                }
            });

I am a newbie to javascript, so any help would be appreciated. Please only mention the javascript solutions. Thanks in advance.

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!