469,280 Members | 1,816 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,280 developers. It's quick & easy.

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 6707
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 CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.