Closed codler closed 3 years ago
Hi. Why don’t you simply update to the latest version.
On Wed, 23 Jun 2021 at 20:35, Han Lin Yap @.***> wrote:
@catamphetamine https://github.com/catamphetamine Hi, could you provide an options in v5 to skip empty lines to make it backward compatible with v4?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/catamphetamine/read-excel-file/issues/94, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADUP346B75T65V2XK4GGWDTUILOZANCNFSM47GII7PQ .
Yes, i want to use latest version, but it have big breaking changes, by adding the option , in latest version, to make possible to skip empty lines again would solve this
What changes exactly are an issue?
On Thu, 24 Jun 2021 at 00:12, Han Lin Yap @.***> wrote:
Yes, i want to use latest version, but it have big breaking changes, by adding the option , in latest version, to make possible to skip empty lines again would solve this
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/catamphetamine/read-excel-file/issues/94#issuecomment-867162745, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADUP37NUXBOIGURVRMM3MLTUJE5FANCNFSM47GII7PQ .
In v5
readXlsxFile() now doesn't skip empty rows or columns: it only skips empty rows or columns at the end, but not in the beginning and not in the middle as it used to.
@codler Oh, I see: there's no option to skip empty rows now. Can you provide an example of how your Excel file looks like (approximately) and why are there empty rows?
@codler
When using a schema
, see transformData
function parameter that can remove empty rows:
https://github.com/catamphetamine/read-excel-file#transforming-rowscolumns-before-schema-is-applied
readXlsxFile(file, {
schema,
transformData(data) {
// Removes empty rows.
return data.filter(row => row.filter(column => column !== null).length > 0)
}
})
When not using a schema
, just do:
// Removes empty rows.
data = data.filter(row => row.filter(column => column !== null).length > 0)
Seems to work, thank you @catamphetamine !
@catamphetamine Hi, could you provide an options in v5 to skip empty lines to make it backward compatible with v4?