-
-
Notifications
You must be signed in to change notification settings - Fork 106
Description
Version
0.14.2
Description of the bug
Unable to parse file with parseWorkbooks() decoding error
Code
import CoreXLSX
let filepath = "./Res_Inclu_TOU_Current.xlsx"
guard let file = XLSXFile(filepath: filepath) else {
fatalError("XLSX file at \(filepath) is corrupted or does not exist")
}
for wbk in try file.parseWorkbooks() {
for (name, path) in try file.parseWorksheetPathsAndNames(workbook: wbk) {
if let worksheetName = name {
print("This worksheet has a name: \(worksheetName)")
}
let worksheet = try file.parseWorksheet(at: path)
for row in worksheet.data?.rows ?? [] {
for c in row.cells {
print(c)
}
}
}
}
File for reproduction
Additional context
I had this working for a few years, but I guess something in the energy company's xlsx file generation changed.
Output
Swift/ErrorType.swift:200: Fatal error: Error raised at top level: Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "relationship", intValue: nil), XMLKey(stringValue: "1", intValue: 1), XMLKey(stringValue: "1", intValue: 1), CodingKeys(stringValue: "type", intValue: nil)], debugDescription: "Cannot initialize SchemaType from invalid String value http://schemas.microsoft.com/office/2020/02/relationships/classificationlabels", underlyingError: nil))