1 |
On Wednesday 13 June 2007 15:04, Boyd Stephen Smith Jr. wrote: |
2 |
> I am. |
3 |
> |
4 |
> Here's a script that will dump a worksheet as a csv. Save, chmod a+x, and |
5 |
> invoke like name_of_script name_of_excel_file worksheet_number > csv_file |
6 |
> (e.g. ./convertxls price_list.xls 0 > price_list.csv): |
7 |
> |
8 |
> #! /usr/bin/ruby |
9 |
> require 'parseexcel' |
10 |
> |
11 |
> wb = Spreadsheet::ParseExcel.parse(ARGV.shift) |
12 |
> ws = workbook.worksheet(ARGV.shift.to_i) |
13 |
> ws.each { |row| |
14 |
> puts row.collect { |cell| |
15 |
> '"' + cell.to_s.gsub(/"/, '""') + '"' |
16 |
> }.join(',') |
17 |
> } |
18 |
> |
19 |
> Clearly, all the heavy lifting is done by that library, which you will need |
20 |
> to run this script. |
21 |
|
22 |
This script doesn't work for me :( |
23 |
I have ruby & parseexcel installed... |
24 |
|
25 |
$ ./excel2cvs.rb complect.xls 0 > complect.cvs |
26 |
./excel2cvs.rb:5: undefined local variable or method `workbook' for |
27 |
main:Object (NameError) |
28 |
|
29 |
|
30 |
|
31 |
-- |
32 |
best regards, |
33 |
Aleksey V. Kunitskiy |
34 |
-- |
35 |
gentoo-user@g.o mailing list |