I want to create an excel file from data I get from my DB but since
some of my fields contain commas in them I was hoping I can use
CSV::Writer but instead of having the default of commas seperate data
I could use tabs? Any have any suggestions on what the sexiest way to
do this is?
If you want to avoid the intermediate CSV files you could use OLE to
drive Excel, or Spreadsheet
(http://rubyspreadsheet.sourceforge.net/\) to create the file (even if
Excel is not installed).
Cheers
Chris
···
On Jan 29, 11:22 am, "John Kopanas" <kopa...@gmail.com> wrote:
I want to create an excel file from data I get from my DB but since
some of my fields contain commas in them I was hoping I can use
CSV::Writer but instead of having the default of commas seperate data
I could use tabs? Any have any suggestions on what the sexiest way to
do this is?
> I want to create an excel file from data I get from my DB but since
> some of my fields contain commas in them I was hoping I can use
> CSV::Writer but instead of having the default of commas seperate data
> I could use tabs? Any have any suggestions on what the sexiest way to
> do this is?
it is okay to have commas in CSV fields.
require 'rubygems'
=> true
require 'fastercsv'
=> true
%w[ foo,bar baz ].to_csv
=> "\"foo,bar\",baz\n"
CSV in the stdlib should handle this correctly as well.
So that having been said, possibly the sexiest way to do SQL to CSV is
via Ruport.
···
On 1/29/07, ChrisH <chris.hulan@gmail.com> wrote:
On Jan 29, 11:22 am, "John Kopanas" <kopa...@gmail.com> wrote: