catamphetamine / read-excel-file

Read *.xlsx files in a browser or Node.js. Parse to JSON with a strict schema.
https://catamphetamine.gitlab.io/read-excel-file/
MIT License
301 stars 52 forks source link

When Import Excel sheet with blank coloum #62

Closed ravindra8chouhan closed 4 years ago

ravindra8chouhan commented 4 years ago

When we import excel sheet with blank coloum, like a, b ,d column having data, but in c we define blank column then read-excel-file module never read that c column. How can we fixed this. Please resolve and let me know.

catamphetamine commented 4 years ago

Empty columns are always skipped by design. You can fork if you want. The line: https://github.com/catamphetamine/read-excel-file/blob/e6e383a8c222f1c1fb60900d6405de8524ccca84/source/readXlsx.js#L115

RoySegall commented 4 years ago

Sorry for re-open this one but I kind of need this feature. What about passing a flag, something like:

readXlsxFile(path, {getSheets: true, skipEmptyLines: false});

I can create a patch but would you rather merge the patch?

catamphetamine commented 4 years ago

@RoySegall Your issue seems like a completely different one: you're saying about not skipping empty lines. This library isn't likely to support something like that, your case seems to be the minority.

RoySegall commented 4 years ago

The thing is that I need to know the number of line of the row in the file and when I have empty lines I can't get that number correctly. Any ideas?

catamphetamine commented 4 years ago

The thing is that I need to know the number of line of the row in the file

Why?

RoySegall commented 4 years ago

I'm processing a file that contains a list of holdings such as: physical assets, coins types (euro, dollar), stock IDs, and more. The problem is that the data in the file does not have a standard (one line can be USD, u.s.d) and we need to eventually provide a report that tells where is the faulty record.

In order to that, I need to know the line number of which the cell value came from. Because empty lines are ignored I need a way to track it.

catamphetamine commented 4 years ago

and we need to eventually provide a report that tells where is the faulty record.

For error reporting, there's validate() function of a column, and the errors result property.

RoySegall commented 4 years ago

The problem is that the excel file doesn't have a structured format and a schema won't be applied here. It's kind of complicated to explain and I'm pretty sure that you don't know Hebrew so I won't upload the file.

Any way - is there a way to pass a flag that won't skip empty lines (I'll make a PR for that) or maybe pass a flag that will bring the line number with a flag.

catamphetamine commented 4 years ago

It's kind of complicated to explain and I'm pretty sure that you don't know Hebrew so I won't upload the file.

So, yeah, your case is a very specific one and doesn't deserve a feature in a library.

Any way - is there a way to pass a flag that won't skip empty lines (I'll make a PR for that) or maybe pass a flag that will bring the line number with a flag.

You can just fork and patch the code.

catamphetamine commented 3 years ago

Published read-excel-file@5.0.0 that doesn't skip empty rows or columns in the beginning and in the middle (only discards empty rows and columns at the end).