- Added new parameters to replace the old
includeNullValues: true
parameter:schemaPropertyValueEmptyCellValue
,schemaPropertyValueForMissingColumn
,getEmptyObjectValue
. NowincludeNullValues: true
could be replaced with the following combination of parameters:schemaPropertyValueForMissingColumn: null
schemaPropertyValueForEmptyCell: null
getEmptyObjectValue = (object, { path? }) => null
- Added
schemaPropertyShouldSkipRequiredValidationForMissingColumn: () => boolean
parameter. It is() => false
by default. - Added
getEmptyArrayValue: (array, { path }) => any
parameter. It is() => null
by default.
- Moved from
jszip
tofflate
. Most likely not a "breaking change". See browser support.
-
Added
ignoreEmptyRows: false
option when parsing using aschema
. -
Changed
errors.row
property when parsing using aschema
: from "object number" to "spreadsheet row number". Example: was1
for the first row of data, now is2
for the first row of data (because1
now is the header row).
- Fixed non-ASCII character encoding by forcing Node.js version of the library to read zipped contents of an XLSX file in UTF-8 character encoding. I suppose it won't break the existing code.
- Added
includeNullValues: true
option when parsing spreadsheet data using aschema
. By default, it ignores allnull
values (ignores all empty cells).
- Added an optional
reason?: string
property of a with-schema parsing error.
- Added
trim: false
option.
- Migrated to ES Modules exports.
- Added
readSheetNames()
function.
- Fixed skipping empty rows and columns at the start.
- Added
/web-worker
export.
- Added TypeScript "typings".
-
(internal) Removed
xpath
dependency to reduce bundle size. -
(internal) Removed
xmldom
dependency in the browser to reduce bundle size. -
(internal) Fixed date parser: in previous versions it was setting time to
12:00
instead of00:00
. -
(internal)
readXlsxFile()
: Added support fore
,d
,z
andinlineStr
cell types.
- Simply updated all dependencies to their latest version.
-
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. -
Removed
"URL"
,"Email"
,"Integer"
types. Use non-string exported ones instead:URL
,Email
,Integer
. -
Removed undocumented
convertToJson()
export. -
Removed undocumented
read-excel-file/json
export.
-
Renamed schema entry
parse()
function: now it's calledtype
. This way,type
could be both a built-in type and a custom type. -
Changed the built-in
"Integer"
,"URL"
and"Email"
types: now they're exported functions again instead of strings. Strings still work. -
Added
map
parameter: similar toschema
but doesn't perform any parsing or validation. Can be used to map an Excel file to an array of objects that could be parsed/validated usingyup
. -
type
of a schema entry is no longer required: if notype
is specified, then the cell value is returned "as is" (string, or number, or boolean, orDate
).
- Updated
JSZip
to the latest version. The issue. The original issue.
- (breaking change) Turned out that
sheetId
is not the file name of the sheet. Instead, the filename of the sheet is looked up byr:id
(orns:id
) in thexl/_rels/workbook.xml.rels
file. That means that reading Excel file sheets by their numericsheet
ID is no longer supported inreadXlsxFile()
and ifsheet
option is specified then it means either "sheet index" (starting from1
) or "sheet name". Also, removed the old deprecated way of passingsheet
option directly asreadXlsxFile(file, sheet)
instead ofreadXlsxFile(file, { sheet })
.
- Fixed IE 11 error
"XPathResult is undefined"
by including a polyfill for XPath. This resulted in the browser bundle becoming larger in size by 100 kilobytes.
-
(breaking change) Calling this library with
getSheets: true
option now returns an array of objects of shape{ name }
rather than an object of shape{ [id]: 'name' }
. Same's for calling this library withproperties: true
option. -
(breaking change) Previous versions returned empty data in case of an error. Now if there're any errors they're thrown as-is and not suppressed.
-
(unlikely breaking change) Previous versions read the
sheet
having ID1
by default. It was discovered that this could lead to unintuitive behavior in some Excel editors when sheets order is changed by a user: in some editors a sheet with ID1
could be moved to, for example, the second position, and would still have the ID1
so for such Excel files by default the library would read the second sheet instead of the first one which would result in confusing behavior. In any case, numerical sheet IDs are inherently internal to the Excel file structure and shouldn't be externalized in any way (in this case, in the code reading such files) so the library now still accepts the numericalsheet
parameter but rather than being interpreted as a numerical sheet ID it's now interpreted as a numerical sheet index (starting from1
). If your code passes a numericalsheet
ID parameter to the library then it will most likely behave the same way with the new version because in most cases a numerical sheet ID is the same as a numerical sheet index. This change is very unlikely to break anyone's code, but just to conform with the SEMVER specification this change is released as a "breaking change" because theoretically there could exist some very rare users affected by the change. -
(very unlikely breaking change) Removed legacy support for numerical
sheet
IDs passed not as numbers but as strings. For example,sheet: "2"
instead ofsheet: 2
. A stringsheet
parameter is now always treated as a sheet name.
-
Fixed
NaN
s appearing in the input instead ofnull
s (and empty columns not being trimmed). -
Added "smart date parser" which autodetects and parses most date formats.
-
(breaking change) If using
readXlsx()
withoutschema
parameter it now parses boolean cell values astrue
/false
and numerical cell values are now parsed as numbers, and also date cell values are parsed as dates in some cases (numbers otherwise). If usingreadXlsx()
withschema
parameter then there are no breaking changes. -
Added
dateFormat
parameter (e.g.mm/dd/yyyy
) for parsing dates automatically when usingreadXlsx()
withoutschema
parameter. -
Added
read-excel-file/json
export forconvertToJson()
.
- Refactored exports.
- Fixed some empty columns returning an empty string instead of
null
. - Added
Integer
type for integerNumber
s. AlsoURL
andEmail
. - Export
parseExcelDate()
function. - If both
parse()
andtype
are defined in a schema thenparse()
takes priority overtype
.
- Rewrote
schema
JSON parsing.
- Added
schema
option for JSON parsing.
- Initial release.