Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7610181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:21:28+00:00 2026-05-31T01:21:28+00:00

I am trying to parse a XLS file with the roo gem without using

  • 0

I am trying to parse a XLS file with the roo gem without using a file upload plugin. Unfortunately I can not access the data of the File.

I get the error:

#<File:0x007ffac2282250> is not an Excel file

So roo is not recognizing the file as an Excel file. Do I need to save the file locally to use roo or is there a way around that. I would like to parse the data of the excel file directly into the database.

The params that are coming through:

Parameters: {"utf8"=>"✓", "authenticity_token"=>"yLqOpSK981tDNYjKSoWBh0VnFEKSk0XA/wOt3r+yWJc=", "uploadform"=>{"name"=>"xls", "file"=>#<ActionDispatch::Http::UploadedFile:0x007ffac22b6550 @original_filename="cities2.xls", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"uploadform[file]\"; filename=\"cities2.xls\"\r\nContent-Type: application/octet-stream\r\n", @tempfile=#<File:/var/folders/qn/70msrkt90pd390sdr14_0g2m0000gn/T/RackMultipart20120306-3729-1m2xcsp>>}, "commit"=>"Save Uploadform"}

I am trying to access the file with

    if params[:uploadform][:file].original_filename =~ /.*\.xls$/i
        oo = Excel.new(params[:uploadform][:file].open)

        rooparse(oo)
    end

I also tried params[:uploadform][:file].read and params[:uploadform][:file] already but I think the .open would be the correct method here!?

And would you recommend using paperclip or carrierwave here?

Thank you for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:21:29+00:00Added an answer on May 31, 2026 at 1:21 am

    Looking at the source for Excel.new, it seems that it wants a file name, not a File object or handler. In other words, it needs string representation of the full path, including filename, to the the file you want to parse. Also, it checks the extension of the file. So if the tempfile doesn’t end with “.xls” you’ll need to rename the file first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to parse an INI file using C++. Any tips on what is
Trying to parse a YouTube feed using PHP simplexml_load_file(); I am able to access
I'm trying to parse a file from the web on Android using the DOM
Whilst trying to parse MS Excel file using POI-HSSF v3.2 I am getting IndexOutOfBoundsException.
Trying to parse a csv file that has all the data wrapped in double
Am trying to parse the RSS feed from www.ted.com/talks/rss, I can access all normal
Trying to parse Maplines for an airport. Each airport can have X number of
Im trying to parse the string located in /proc/stat in a linux filesystem using
Im trying to parse an JSON response string to my class objects.. I can't
I'm trying to parse a MIME-Message, using SharpMimeTools and some sample Mime Messages from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.