Skip to main content.
home | support | download

Back to List Archive

Re: Good Excel parser

From: Bill Moseley <moseley(at)>
Date: Wed May 28 2003 - 18:19:12 GMT
On Wed, May 28, 2003 at 09:00:19AM -0700, Roubart Capcap wrote:
> Hello,
> Does anybody know of a good Excel parser?  I tried the Swish Filters
> with the following code in my
> use lib '/swish-e-2.2.3/filters/SWISH/Filters';
> use XLtoHTML;
> sub xl {
>    my ( $uri, $server, $response, $content_ref ) = @_;
>    return 1 unless $response->content_type eq 'application/';
>    # for logging counts
>    $server->{counts}{'XLS transformed'}++;
>    $$content_ref = ${XLtoHTML( $content_ref )};
>    $$content_ref =~ tr/ / /s;
>    return 1;
> }

I assume you have Spreadsheet::ParseExcel installed?  I also don't know 
if you can call XLtoHTML() directly.  You should call it from 
SWISH::Filter.  See

There's also a "TESTING" section that shows how to test the filter 
outside of swish-e or

It says:

[This module can be run as a program directly. Change directory 
to the location of the module and run:

  perl -I.. test  foo.pdf  bar.doc

replace foo.pdf and bar.doc with real paths on your system. The -I.. is 
needed for loading the filter modules.]

You don't really have to change directory to the location of  
You can run from any directory.  For example

   perl -I/home/moseley/swish-e/filters \
        /home/moseley/swish-e/filters/ \

That should show you if the filtering is working.

BTW -- The new version of Swish-e has a filter (a SWISH::Filter) that
uses the Perl module Spreadsheet::ParseExcel (available from CPAN).  The
new will automatically use it if you have
Spreadsheet::ParseExcel installed.

Bill Moseley
Received on Wed May 28 18:19:20 2003