How to get Excel data in JSON format? #2246
Unanswered
yuqiang1999
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have successfully read the content of an Excel file by reading the documentation and setting the columns as follows:
worksheet.columns = [
{ header: 'Id', key: 'id', width: 10 },
{ header: 'Name', key: 'name', width: 32 },
{ header: 'D.O.B.', key: 'DOB', width: 10, outlineLevel: 1 }
];
Then I retrieved the data by using:
const rows = worksheet.getRows(4, worksheet.actualRowCount-3)
const data = rows.map(item => item.values)
However, the data is not returned in the form of a JSON object array.
What format do I want it to be in:
[{ id: '1', name: 'test'. DOB: 'test'}, {id: '2', name: 'test'. DOB: 'test'}]
How should I handle this?
Beta Was this translation helpful? Give feedback.
All reactions