Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

archiveEntryNotFound error #121

Closed
Davvie opened this issue Jul 8, 2020 · 11 comments · Fixed by #122 or #123
Closed

archiveEntryNotFound error #121

Davvie opened this issue Jul 8, 2020 · 11 comments · Fixed by #122 or #123
Assignees
Labels
bug Something isn't working

Comments

@Davvie
Copy link

Davvie commented Jul 8, 2020

Version

0.12.0

Description of the bug

An archiveEntryNotFound error is thrown for certain files (but I couldn't figure out what exactly causes the issue)

Steps to reproduce

  1. Load the file attached bellow (let file = XLSXFile(filepath: tableFilePath))
  2. Call parseSharedStrings

File for reproduction

Test.xlsx
https://tools.hb.bizmrg.com/Test.xlsx

@MaxDesiatov
Copy link
Collaborator

Hi @Davvie, this means that the file doesn't have shared strings in it, all strings are stored as inline. Right now you can catch the error and continue parsing the rest of the data without shared strings. Does that resolve the issue for you?

@MaxDesiatov MaxDesiatov assigned Davvie and unassigned MaxDesiatov Jul 9, 2020
@MaxDesiatov MaxDesiatov added the question Further information is requested label Jul 9, 2020
@MaxDesiatov
Copy link
Collaborator

You can catch this specific error stay on the safe side: CoreXLSXError.archiveEntryNotFound.

@MaxDesiatov
Copy link
Collaborator

Also, would you mind if I include the file that you attached here to the CoreXLSX test suite?

@Davvie
Copy link
Author

Davvie commented Jul 9, 2020

Hi @Davvie, this means that the file doesn't have shared strings in it, all strings are stored as inline. Right now you can catch the error and continue parsing the rest of the data without shared strings. Does that resolve the issue for you?

Hi @MaxDesiatov, thank you for a quick reply. After further testing I found out that parseSharedStrings is not the only method that throws this error while trying to parse this file. parseWorksheet also does

Here is an example:

import Foundation
import CoreXLSX

let path = ("~/Desktop/Test.xlsx" as NSString).expandingTildeInPath
let file = XLSXFile(filepath: path)!

let workbook = try file.parseWorkbooks()[0]

let sheetPath = try file.parseWorksheetPaths()[0]
let sheet = try file.parseWorksheet(at: sheetPath)

for row in sheet.data?.rows ?? [] {
    print(row)
}

Also, would you mind if I include the file that you attached here to the CoreXLSX test suite?

Sure, no problem

@MaxDesiatov
Copy link
Collaborator

Cool, thank you for the sample file! The issue with parseWorksheet seems to be similar to #94. Would you be able to update to the latest 0.13.0 version and try if the issue reproducible with it too?

@Davvie
Copy link
Author

Davvie commented Jul 9, 2020

Cool, thank you for the sample file! The issue with parseWorksheet seems to be similar to #94. Would you be able to update to the latest 0.13.0 version and try if the issue reproducible with it too?

You're welcome. Sure, I've tested this code snippet with 0.13.0, but unfortunately it fails with the same error

Here is another sample file which also fails for that snippet
Test2.xlsx

@Davvie
Copy link
Author

Davvie commented Jul 9, 2020

What is common between these sample files is that they're both either edited or created using Python's openpyxl module (but they seem to open fine in Excel though)

@MaxDesiatov
Copy link
Collaborator

Ah, that probably explains it. If the file opens in Excel, that still means it's a bug in CoreXLSX, I'm having a closer look now.

@MaxDesiatov MaxDesiatov added bug Something isn't working and removed question Further information is requested labels Jul 9, 2020
@MaxDesiatov MaxDesiatov assigned MaxDesiatov and unassigned Davvie Jul 9, 2020
@MaxDesiatov
Copy link
Collaborator

The issue should be fixed in the main branch now, please feel free to reopen otherwise. Thanks again for the detailed report!

@Davvie
Copy link
Author

Davvie commented Jul 9, 2020

Thank you a lot for the fix and all the hard work you put into CoreXLSX!

@MaxDesiatov
Copy link
Collaborator

No problem! If you enjoy working with CoreXLSX, please consider sponsoring me on GitHub with monthly donations or on my website with a one-time payment 😉

MaxDesiatov added a commit that referenced this issue Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants