rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org
2007-Apr-25 12:22 UTC
Convert data as CSV problem
hi all, I want to convert my data as CSV file. just i used simple coding, i didn''t use fastercsv, because i installed in my system, but i couldn''t see where it install, if i run also , it said there is no fastercsv file. actaully i don''t know how to use that. so now i used simple code is, but in this csv file is downloaded , by its coming with all HTML tags, even i didn''t use any html tags. so i want to know how to avoid this. please any one help me. thanks in advance. in controller: def report @partner=Code.find(:all) response.headers[''Content-Type''] = ''text/csv; charset=iso-8859-1; header=present'' response.headers[''Content-Disposition''] = ''attachment; filename=report.csv'' end -------------------- in rhtml: Title,Value <% @partners.each do |model| -%> "<%= model.member_fname %>",<%= model.member_lname %> <% end -%> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org wrote:> I want to convert my data as CSV file. just i used simple coding, iCheck out this plugin: http://svn.integralserver.com/plugins/to_csv/ It does all the hard work for you. Eric --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org
2007-Apr-25 13:05 UTC
Re: Convert data as CSV problem
Eric Anderson wrote:> rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org wrote: >> I want to convert my data as CSV file. just i used simple coding, i > > Check out this plugin: > > http://svn.integralserver.com/plugins/to_csv/ > > It does all the hard work for you. > > Erichi, thank u very much for your quick response. is there any other way instead of plugin. because i can''t install this in client server -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org wrote:> thank u very much for your quick response. is there any other way > instead of plugin. because i can''t install this in client serverSure. Just do the same things this plugin does. I don''t understand why you cannot install the plugin? Rails plugins are installed with the project so if you can edit the project files you can install the plugin. Eric --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Here''s a simple example of using the CSV module, I''m fairly sure this comes with the standard distribution of Ruby: require ''csv'' data = "" CSV::Writer.generate(data) { |csv| csv << [''data_item1,''data_item2''] } File.open(OUTPUT_FILENAME, ''w'') { |file| file << data } On Apr 25, 8:10 am, Eric Anderson <e...-ANzg6odk14w@public.gmane.org> wrote:> rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org wrote: > > thank u very much for your quick response. is there any other way > > instead of plugin. because i can''t install this in client server > > Sure. Just do the same things this plugin does. I don''t understand why > you cannot install the plugin? Rails plugins are installed with the > project so if you can edit the project files you can install the plugin. > > Eric--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Here''s a simple example of using the CSV module, I''m fairly sure this comes with the standard distribution of Ruby: require ''csv'' data = "" CSV::Writer.generate(data) { |csv| csv << [''data_item1,''data_item2''] } File.open(OUTPUT_FILENAME, ''w'') { |file| file << data } On Apr 25, 8:10 am, Eric Anderson <e...-ANzg6odk14w@public.gmane.org> wrote:> rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org wrote: > > thank u very much for your quick response. is there any other way > > instead of plugin. because i can''t install this in client server > > Sure. Just do the same things this plugin does. I don''t understand why > you cannot install the plugin? Rails plugins are installed with the > project so if you can edit the project files you can install the plugin. > > Eric--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org
2007-Apr-26 05:02 UTC
Re: Convert data as CSV problem
DZ wrote:> Here''s a simple example of using the CSV module, I''m fairly sure this > comes with the standard distribution of Ruby: > > require ''csv'' > data = "" > > CSV::Writer.generate(data) { |csv| > csv << [''data_item1,''data_item2''] > } > > File.open(OUTPUT_FILENAME, ''w'') { |file| file << data }hi, for this csv writer , have i to install anything, or simple this code only will work. can u say please -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi ! 2007/4/25, rails-mailing-list@andreas-s.net <rails-mailing-list@andreas-s.net>:> I want to convert my data as CSV file. just i used simple coding, i > didn't use fastercsv, because i installed in my system, but i couldn't > see where it install, if i run also , it said there is no fastercsv > file. actaully i don't know how to use that.You might want to read my blog post on just this topic: http://blog.teksol.info/articles/2006/03/23/returning-csv-data-to-the-browser Hope that helps ! -- François Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I heard active_record extensions have a great .to_csv method, is that the same as the CSV plugin mentioned above? On Apr 26, 7:11 am, "François Beausoleil" <francois.beausol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi ! > > 2007/4/25, rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org <rails-mailing-l...@andreas-s.net>: > > > I want to convert my data as CSV file. just i used simple coding, i > > didn''t use fastercsv, because i installed in my system, but i couldn''t > > see where it install, if i run also , it said there is no fastercsv > > file. actaully i don''t know how to use that. > > You might want to read my blog post on just this topic:http://blog.teksol.info/articles/2006/03/23/returning-csv-data-to-the... > > Hope that helps ! > -- > François Beausoleilhttp://blog.teksol.info/http://piston.rubyforge.org/--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org
2007-Apr-26 08:40 UTC
Re: Convert data as CSV problem
François Beausoleil wrote:> Hi ! > > 2007/4/25, rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: >> I want to convert my data as CSV file. just i used simple coding, i >> didn''t use fastercsv, because i installed in my system, but i couldn''t >> see where it install, if i run also , it said there is no fastercsv >> file. actaully i don''t know how to use that. > > You might want to read my blog post on just this topic: > http://blog.teksol.info/articles/2006/03/23/returning-csv-data-to-the-browser > > Hope that helps ! > -- > Fran篩s Beausoleil > http://blog.teksol.info/ > http://piston.rubyforge.org/hi, i saw ur link, actually i followed this link only the second step. i got the answer. but it shows full of html coding in excel sheet. i want to show only anser instead of html tags. and now i am going to try this first step also. for the have we install CSV:WRITER , or we can use like this. Thanks for ur help -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I checked and this is part of the standard library. http://www.ruby-doc.org/stdlib/libdoc/csv/rdoc/index.html On Apr 26, 12:02 am, rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org wrote:> DZ wrote: > > Here''s a simple example of using the CSV module, I''m fairly sure this > > comes with the standard distribution of Ruby: > > > require ''csv'' > > data = "" > > > CSV::Writer.generate(data) { |csv| > > csv << [''data_item1,''data_item2''] > > } > > > File.open(OUTPUT_FILENAME, ''w'') { |file| file << data } > > hi, > > for this csv writer , have i to install anything, or simple this code > only will work. can u say please > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---