weshatheleopard / rubyXL

Ruby lib for reading/writing/modifying .xlsx and .xlsm files
MIT License
1.28k stars 255 forks source link

how to parse an xlsx file stored in activestorage and published in S3 #391

Closed merakissb closed 3 years ago

merakissb commented 3 years ago

Hi,I am new to rails and its sea of ​​gems. (excuse me if what I'm asking seems obvious to some)

I am doing a project that reads and writes to xlsx file. To read I use 'roo' and to write I use 'rubyXL'.

The downside is that when trying to use workbook = RubyXL :: Parser.parse_buffer (file.service_url) throws me a zip error.

Zip :: Error (XLSX file format error: Zip end of central directory signature not found)

How can i fix this? thanks in advance.

weshatheleopard commented 3 years ago
  1. Please understand that his is not StackExchange, you do not come here to ask questions on how to accomplish something you need, you come here to report actual problems with our software.
  2. Parameter to Parser#parse_buffer is the buffer/string containing the actual body of the XLSX file. Whereas the snippet you supply, you are passing the URL at which the said file resides -- not the actual data.
  3. You are saying that "to write I use 'rubyXL'." But in your snippet, you are trying to use RubyXL to read the file. Are you sure you understand what you are doing?