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 read xlsx file #130

Closed
wasim954 opened this issue Sep 14, 2020 · 5 comments
Closed

Unable to read xlsx file #130

wasim954 opened this issue Sep 14, 2020 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@wasim954
Copy link

Hey @MaxDesiatov, i am trying to read xlsx file but getting value '0' every time

i am attaching sample xlsx file
it has 4 worksheets

  • xl/worksheets/sheet1.xml
  • xl/worksheets/sheet12xml
  • xl/worksheets/sheet3.xml
  • xl/worksheets/sheet4xml

as i am trying to get data of "xl/worksheets/sheet1.xml" worksheets

let file = XLSXFile(filepath: filePath)
let worksheet = try file.parseWorksheet(at: "xl/worksheets/sheet1.xml");
let cellValue = getTextFrom(worksheet.data!.rows[0].cells[0])

i am getting cellValue is 0 but is suppose to be This sheet is provided by PPPoker Co., Ltd. and is based on the derivative data of the virtual game currency , which is only a reference and does not have legal effect.

func getTextFrom(_ cell : Cell) -> String {
var text = ""
if cell.inlineString != nil {
text = cell.inlineString!.text ?? ""
}
else if cell.value != nil {
text = cell.value ?? ""
}
return text
}

file.xlsx

@MaxDesiatov
Copy link
Collaborator

The textual data is most frequently stored in shared strings, did you try using parseSharedStrings and stringValue APIs as described in the corresponding README.md subsection?

@MaxDesiatov MaxDesiatov assigned wasim954 and unassigned MaxDesiatov Sep 14, 2020
@MaxDesiatov MaxDesiatov added the question Further information is requested label Sep 14, 2020
@wasim954
Copy link
Author

Thanks for quick reply

@MaxDesiatov
Copy link
Collaborator

No problem, thanks for trying CoreXLSX 🙂 Feel free to open an issue if you have any other questions or problems.

@wasim954
Copy link
Author

while trying to read on background thread i am loosing control access

DispatchQueue.global(qos: .background).async {
print("This is run on the background queue")

DispatchQueue.main.async {
    print("This is run on the main queue, after the previous code in outer block")
}

}

@MaxDesiatov
Copy link
Collaborator

Could you clarify please what exactly do you mean by "control access"? What issue are you experiencing, and what behavior do you expect?

Also, the code in your last comment doesn't seem to contain any CoreXLSX types or calls. Unfortunately, I won't be able to diagnose issues without context. You'll need to share more code that interacts with CoreXLSX, so that I could reproduce the issue on my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants