Re: Excel to MySQL??

From: Date: Sat, 29 Jun 2002 21:47:42 +0000
Subject: Re: Excel to MySQL??
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-20205@lists.php.net to get a copy of this message
At 15:21 -0600 6/29/02, Chase wrote:
Does anyone know of a way that I can export an Excel spreadsheet to a file that I can import to MySQL? I found a program that will do this for Access, but I would rather leave Access out of this if possible. Thanks!! Chase
Does it have to be written in PHP? :-) #! /usr/bin/perl -w # from_excel.pl - read Excel spreadsheet, write tab-delimited, # linefeed-terminated output to the standard output. use strict; use Spreadsheet::ParseExcel::Simple; @ARGV or die "Usage: $0 excel-file\n"; my $xls = Spreadsheet::ParseExcel::Simple->read ($ARGV[0]); foreach my $sheet ($xls->sheets ()) {
        while ($sheet->has_data ())
        {                 my @data = $sheet->next_row ();
                print join ("\t", @data) . "\n";
        }
} exit (0);

« previous php.db (#20205) next »