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

Unable to parse excel with following code #159

Open
manish12jain opened this issue Apr 15, 2022 · 5 comments
Open

Unable to parse excel with following code #159

manish12jain opened this issue Apr 15, 2022 · 5 comments

Comments

@manish12jain
Copy link

manish12jain commented Apr 15, 2022

I am using main branch which i have installed using following pod

pod 'CoreXLSX'

I am trying to read one excel but its giving me random integer number instead of string.

Test12.xlsx

    func getExcelData(pathNew: URL) {
                
        let k: UInt32 = 10 * 1024 * 1024
        
        guard let file = try? XLSXFile(data: Data(contentsOf: pathNew), bufferSize: k, errorContextLength: 10) else {
            return }

        do {
            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)
                    
                    let array = worksheet.data?.rows.map { $0.cells.map { $0.value ?? "" } }
                }
            }
        } catch {
            print(error)
        }

Screenshot 2022-04-15 at 8 46 01 PM

@tburnt
Copy link

tburnt commented Jul 22, 2022

Same here using
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL])

if I converted urls.first!.path it does not read the xlsx document

I tried the both

XLSXFile(filepath: )
XLSX(data: )

But it still does not read the file

@MaxDesiatov
Copy link
Collaborator

MaxDesiatov commented Jul 22, 2022

@tburnt please refer to #160 WRT document picker. Are you providing a security scoped access URL, as described in a solution for this issue? #160

Also, your issue does not seem to be related to the OP. If your issue is not resolve with security scoped access URLs, please create a new issue. Thanks.

@tburnt
Copy link

tburnt commented Jul 22, 2022

Hello thanks for the fast response I tried #160 as well however I had no luck in opening the excel file

@MaxDesiatov
Copy link
Collaborator

Please create a separate issue and provide additional details there: the exact error message and error type you're seeing, the file you're trying to open, and a self-contained sample project to reproduce. Providing these details will allow me to quickly resolve the issue. Thanks!

@GST-Main
Copy link

Because the cells refer shared string. Follow this guide - https://github.com/CoreOffice/CoreXLSX#shared-strings

@MaxDesiatov MaxDesiatov removed their assignment Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants