Skip to content

Workbook parsing error #185

@brad-w

Description

@brad-w

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

Res_Inclu_TOU_Current.xlsx

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))

Metadata

Metadata

Assignees

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