Skip to content

Commit

Permalink
fix: excel parser error handling (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbrugger authored Apr 26, 2024
1 parent 5f77620 commit e1e79a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/khaki-needles-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@flatfile/plugin-xlsx-extractor': patch
---

This release reattempts to read XLSX files that may have emitted an error that could be handled.
9 changes: 8 additions & 1 deletion plugins/xlsx-extractor/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ export async function parseBuffer(
'File is too large to parse. Try converting this file to CSV.'
)
}
throw e

// Try reading the file again without the 'WTF' option.
workbook = XLSX.read(buffer, {
type: 'buffer',
cellDates: true,
dense: true,
dateNF: options?.dateNF || undefined,
})
}

const sheetNames = Object.keys(workbook.Sheets)
Expand Down

0 comments on commit e1e79a9

Please sign in to comment.