On Wednesday 13 June 2007, Aleksey Kunitskiy <[EMAIL PROTECTED]> wrote 
about 'Re: [gentoo-user] M$ Excel document converter':
> On Wednesday 13 June 2007 14:02, Bertram Scharpf wrote:
> > There's a Ruby package `parseexcel' which seems to work as
> > far as I can test here.
> >
> >   <http://raa.ruby-lang.org/project/parseexcel/>
>
> I'm not a ruby programmer :(

I am.

Here's a script that will dump a worksheet as a csv.  Save, chmod a+x, and 
invoke like name_of_script name_of_excel_file worksheet_number > csv_file 
(e.g. ./convertxls price_list.xls 0 > price_list.csv):

#! /usr/bin/ruby
require 'parseexcel'

wb = Spreadsheet::ParseExcel.parse(ARGV.shift)
ws = workbook.worksheet(ARGV.shift.to_i)
ws.each { |row|
  puts row.collect { |cell|
    '"' + cell.to_s.gsub(/"/, '""') + '"'
  }.join(',')
}

Clearly, all the heavy lifting is done by that library, which you will need 
to run this script.

-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
[EMAIL PROTECTED]                      ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.org/                      \_/     

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to