Gentoo Archives: gentoo-user

From: "Boyd Stephen Smith Jr." <bss03@××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] M$ Excel document converter
Date: Wed, 13 Jun 2007 12:11:11
Message-Id: 200706130704.30092.bss03@volumehost.net
In Reply to: Re: [gentoo-user] M$ Excel document converter by Aleksey Kunitskiy
1 On Wednesday 13 June 2007, Aleksey Kunitskiy <alexey.kv@×××××.com> wrote
2 about 'Re: [gentoo-user] M$ Excel document converter':
3 > On Wednesday 13 June 2007 14:02, Bertram Scharpf wrote:
4 > > There's a Ruby package `parseexcel' which seems to work as
5 > > far as I can test here.
6 > >
7 > > <http://raa.ruby-lang.org/project/parseexcel/>
8 >
9 > I'm not a ruby programmer :(
10
11 I am.
12
13 Here's a script that will dump a worksheet as a csv. Save, chmod a+x, and
14 invoke like name_of_script name_of_excel_file worksheet_number > csv_file
15 (e.g. ./convertxls price_list.xls 0 > price_list.csv):
16
17 #! /usr/bin/ruby
18 require 'parseexcel'
19
20 wb = Spreadsheet::ParseExcel.parse(ARGV.shift)
21 ws = workbook.worksheet(ARGV.shift.to_i)
22 ws.each { |row|
23 puts row.collect { |cell|
24 '"' + cell.to_s.gsub(/"/, '""') + '"'
25 }.join(',')
26 }
27
28 Clearly, all the heavy lifting is done by that library, which you will need
29 to run this script.
30
31 --
32 Boyd Stephen Smith Jr. ,= ,-_-. =.
33 bss03@××××××××××.net ((_/)o o(\_))
34 ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
35 http://iguanasuicide.org/ \_/

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] M$ Excel document converter Bertram Scharpf <lists@×××××××××××××××.de>
Re: [gentoo-user] M$ Excel document converter Bertram Scharpf <lists@×××××××××××××××.de>
Re: [gentoo-user] M$ Excel document converter Aleksey Kunitskiy <alexey.kv@×××××.com>