473,434 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 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 6945
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

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

Similar topics

12
by: Gary Nutbeam | last post by:
I've noticed that the Perl camp has a very nice web/database environment called Maypole. Ruby has the Rails environment which on the surface seems similar to Maypole. I can't find anything in...
65
by: Amol Vaidya | last post by:
Hi. I am interested in learning a new programming language, and have been debating whether to learn Ruby or Python. How do these compare and contrast with one another, and what advantages does one...
4
by: Hitesh | last post by:
Hi, I have three datagrid control on my aspx page and one export to excel button, i want to export all the 3 datagrids contents in one excel file. how can i achive that? -- Thanks Hitesh
3
by: | last post by:
Hello, I have a routine in my Windows application that exports the contents of a datagrid to Excel. It is modeled closely after the HowTo example on MSDN: http://tinyurl.com/5g2jm. Depending...
5
by: Matias | last post by:
I'm not asking if it's better or not than php... I want to know the opinions of web developers about this new toy... Byee..
9
Niheel
by: Niheel | last post by:
I've used the following tutorials to help be get a better understanding of Ruby On Rails or ROR. Installing Ruby on Rails - Fedora / Lighthttpd Tutorial & Setup for Ruby on Rails Rolling with...
0
by: Sridhar | last post by:
Hi, I am having trouble renaming the excel sheet while exporting to excel. we have a datagrid that contains some analytical data. I have the name to the excel file as "temp.xls" inside the code....
10
by: lawrence k | last post by:
I work mostly in PHP, but at the web design firm where I work we are thinking of switching to Ruby on Rails. Our lead designer recently installed Typo on a client's site and he said to us, with...
9
by: Erwin Moller | last post by:
Hi Group, This may seem a odd question in a PHP group, but I think this might be a good place to ask since I am mainly a PHP coder these days that maybe starts with Ruby. Situation: A client...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.