Skip to content

[BUG] workbook.xlsx.readFile fails when auto filters are applied on a column #1788

Open
@mlstoppa

Description

@mlstoppa

🐛 Bug Report

workbook.xlsx.readFile fails when auto filters are applied on a column.

Lib version: 4.2.1
node version: v14.17.3

Steps To Reproduce

My goal is to read an XLSX file to export it as CSV. When the XLSX file has an auto filter on a column, set with a single value then the following code

  const workbook = new Excel.Workbook();
  if (!await workbook.xlsx.readFile(convertParams.path)) {
    return {
      success: false,
      messagge: 'Error reading Excel file'
    }
  }

fails with error:

Error: 500  ->  Unexpected xml node in parseClose: customFilters

When the XLSX file has more than one value set for a given auto filter then the error is as follow:

Error: 500  ->  Unexpected xml node in parseOpen: {"name":"filter","attributes":{"val": "set value"},"isSelfClosing":true}

The expected behaviour:

All or only filtered rows should be loaded into the workbook.

Possible solution (optional, but very helpful):

Adding some options to workbook readfile method:

{
"options" : {
"customFilters": true/false
}
}

to control whether filtered rows should be load or omitted.
Might this be an option?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions