catamphetamine / read-excel-file

Read *.xlsx files in a browser or Node.js. Parse to JSON with a strict schema.

Home Page:https://catamphetamine.gitlab.io/read-excel-file/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rows and errors return undefined values using schema to convert data in json

Lysiah opened this issue · comments

commented

Hi!

I tried to use a schema to transform excel data in json as stated in the documentation, but rows and errors return undefined value.

readXlsxFile(file, { schema }).then(({ rows, errors }) => {
  // `errors` have shape `{ row, column, error, value }`.
  errors.length === 0

  rows === [{
    date: new Date(2018, 2, 24),
    numberOfStudents: 123,
    course: {
      isFree: true,
      title: 'Chemistry'
    },
    contact: '+11234567890',
  }]
})

Does anyone have the same problem I do?

You can put up an online demo if you want someone to look at it.

commented

Damn it! It was a mistake on my part on schema key. Sorry for the inconvenience, it works perfectly, thanks :)