471,604 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,604 software developers and data experts.

Exporting Information from Ruby on rails to a excel sheet.

Hey,

Pretty new to this and I was asked to setup a application at work that stores all the information regarding all the systems in our lab. Long story short I have everything working apart form exporting the information to a excel sheet. I tried this http://www.napcsweb.com/blog/2007/01/24/excel-export-the-stupid-simple-way/#respond,
which seems very straight forward but i still come up with the error "wrong number of arguments". Any ideas on another way to do this? or a better guide to this.

thanks.
Gearoid
Jun 13 '07 #1
2 6777
improvcornartist
303 Expert 100+
Without seeing your code, I don't know how to help you with your current error. However, this is what works for me.

I have defined the following method in my 'application' controller:

Expand|Select|Wrap|Line Numbers
  1. def download
  2.     send_data session[:csv], :filename => params[:filename]
  3. end
Then in the project controller, I have created a csv variable to store all my data elements, separated by commas, using "\n" for new lines. Then store the csv variable in the session and create a link to the download method, passing the filename:

Expand|Select|Wrap|Line Numbers
  1. session[:csv] = @csv
  2. @filename = 'filename.csv'
  3. @link = '<a href="/viewfolder/download?filename=' + @filename + 
  4. '">Download</a><br/>' + "\n"
  5.  
  6. render :text => @link
Hopefully this helps. Let me know how it works out.

Anthony
Jun 14 '07 #2
Hey,

Pretty new to this and I was asked to setup a application at work that stores all the information regarding all the systems in our lab. Long story short I have everything working apart form exporting the information to a excel sheet. I tried this http://www.napcsweb.com/blog/2007/01/24/excel-export-the-stupid-simple-way/#respond,
which seems very straight forward but i still come up with the error "wrong number of arguments". Any ideas on another way to do this? or a better guide to this.

thanks.
Gearoid
There is also a HowTo on the Rails website, wich offers several ways. Even with the spreadsheet.gem
Sep 24 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

65 posts views Thread by Amol Vaidya | last post: by
3 posts views Thread by | last post: by
5 posts views Thread by Matias | last post: by
9 posts views Thread by Erwin Moller | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.