Closed Schwoebel closed 4 years ago
Perhaps your excel file column headers don't match. Or perhaps the header row is not the first row.
I wish that were the case.
But I dumbed it down as much as possible by making a test excel with TEST in A1, the string 'test' in A2, and the string "test again" in A3.
const schema = {
TEST: {
prop: "test",
required: true,
type: String,
},
};
is my schema and it still produces this:
[ [ 'TEST' ], [ 'test' ], [ 'test' ] ]
could this be an excel thing?
any other way I could test this?
Looks like you're arranging columns in rows. So the behavior is as expected. This library doesn't support columns-as-rows layout.
That's not what I'm doing. To show you that there is something wrong, I copied the example from your readme.
and used your schema (leaving out the parsing of the phone number and just using it as a string)
by your readme's descrption I should get
{rows: [{ date: '03/24/2018', numberOfStudents: 123, course: {isFree: true, title: Chemistry}, contact: '(123) 456-7890'}], errors: []}
but I don't.
I get this:
[ [ 'Start Date',
'Number of Students',
'Is Free',
'Course Title',
'Contact' ],
[ '03/24/2018', 123, true, 'Chemistry', '(123) 456-7890' ] ]
Maybe.
Still, you're the only one having the issue.
Until there're other people with similar issues, I guess this shouldn't be open.
As for the reason of the behavior you're observing: only you could find out what's going on there.
You could insert console.log()
s somewhere in node_modules/read-excel-file/commonjs or modules
and see what's going on.
But that would be a long process.
Perhaps you'd better use some other library.
You're right.
The screwy thing about this is that it worked for 6 months and then started doing this out of the blue. No updates done, nothing.
I think your library was great when it was working, but something is going wrong somewhere. Most undoubtedly on my end.
If anyone runs into this with Microsoft Excel for Mac Version 16.27 I wish them luck.
+1 Having the same issue
Having the same issue. Has someone found a way to correct this?
I'm using Node 11 and read-excel-file 4.0.5
When I supply a Schema:
and apply it to:
var sheet = readXlsxFile('data.xlsx',{schema});
I'm not getting back {rows, errors} I'm getting data just as if I had never used a schema.