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

NoMethodError when parsing certain .xlsx files #463

Open
wakasa51 opened this issue Sep 4, 2024 · 2 comments
Open

NoMethodError when parsing certain .xlsx files #463

wakasa51 opened this issue Sep 4, 2024 · 2 comments

Comments

@wakasa51
Copy link

wakasa51 commented Sep 4, 2024

First of all, thank you for creating such a wonderful gem.

I’m currently encountering an issue where a NoMethodError is raised when trying to parse certain .xlsx files.
This error appears with files that were originally created as .numbers files on a Mac and then manually converted to .xlsx by simply changing the file extension.
We understand that files manually converted from .numbers to .xlsx are technically invalid, but sometimes our users attempt to use such files in our product.

Steps to Reproduce:

  1. Attempt to parse a manually converted .xlsx file (for example, a .numbers file renamed to .xlsx) using the following code:
File.open("./test.xlsx") { |f| RubyXL::Parser.parse_buffer(f.read) }
  1. The following error occurs:
NoMethodError: undefined method `root=' for nil:NilClass
from #{ruby_path}/versions/3.2.4/lib/ruby/gems/3.2.0/gems/rubyXL-3.4.27/lib/rubyXL/objects/root.rb:68:in `parse_zip_file'

Version:
rubyXL version: 3.4.27
Ruby version: 3.2.4

Expected Behavior:

It would be greatly appreciated if, instead of a NoMethodError, the library could return a more descriptive error indicating that the parsing failed.

Thank you again for all your hard work on this gem!

@weshatheleopard
Copy link
Owner

Can you please provide a test file that exhibits this behavior?

@wakasa51
Copy link
Author

wakasa51 commented Sep 4, 2024

Thank you for your prompt response!

I’ve attached a sample .xlsx file that exhibits the behavior described in the issue.
test.xlsx

Please let me know if there’s anything else I can provide or if you need further information.

Thank you again for your help!

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

2 participants