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

Error when opening .xlsx files #50

Open
rodrigomageste opened this issue Aug 19, 2023 · 3 comments
Open

Error when opening .xlsx files #50

rodrigomageste opened this issue Aug 19, 2023 · 3 comments

Comments

@rodrigomageste
Copy link

I hope this message finds you well. Firstly, I'd like to express my gratitude for the efforts put into maintaining the SimpleXlsxReader gem – it's been a valuable tool for many.

I've come across an issue while utilizing the gem that I believe needs your attention. The problem arises when I attempt to run the following code snippet:

doc = SimpleXlsxReader.open("tmp/filename.xlsx")

This line of code triggers an error message: RuntimeError: Zip::ZipFile.open_buffer expects an argument of class String or IO. Found: File. After investigating the source of the issue, it seems that the root cause lies within the loader.rb file, precisely at this line.

My solution to this problem was to modify the line SimpleXlsxReader::Zip.open_buffer(string_or_io) to SimpleXlsxReader::Zip.open(string_or_io). This change effectively resolves the issue and allows the code to run smoothly.

I believe this small tweak could prevent similar errors for other users as well. I wanted to bring this to your attention so that it can be reviewed and addressed appropriately.

@rodrigomageste
Copy link
Author

My Gemfile.lock:

simple_xlsx_reader (5.0.0)
  nokogiri
  rubyzip
rubyzip (1.0.0)
nokogiri (1.13.9)

@marcelohenriq99
Copy link

I have same issue, i think this solution looks good!

gammons added a commit to gammons/simple_xlsx_reader that referenced this issue Sep 19, 2024
@gammons
Copy link

gammons commented Sep 22, 2024

This causes the tests to break and also causes breakages with real-world testing.

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

3 participants