-3

Let a Excel file with 3 columns

  • Name | ID | Pass
  • Adam | id123 | pass123
  • Helen | id234 | pass234
  • ken | id567 | pass567

How to make a function that returns Id and Pass if I call by Name.

Ex:

  1. If call Helen It will return Helen's Id and Pass from the excel.
  2. If call ken It will return ken's Id and Pass from the excel.
tense
  • 1
  • 1

1 Answers1

0

Try reading the excel file into javascript first and then maybe come up with a JSON that looks like this:

var data = {
  "Adam": {
        "id": id123,
        "pass": pass123
   },
  "Helen": {
        "id": id456,
        "pass": pass456
   }
}

The values can be now referenced as:

var AdamId = data["Adam"]["id"]
var AdamPass = data["Adam"]["pass"]

See How to parse Excel file in Javascript/HTML5 on how to read an excel file.

Shubham Sharma
  • 714
  • 1
  • 8
  • 18