Re: [PHP-DB] Excel to MySQL?? From: Paul DuBois (paul <email protected>)
Date: 06/29/02

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;

 <email protected> 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  <email protected> = $sheet->next_row ();
                 print join ("\t",  <email protected>) . "\n";
         }
}

exit (0);

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php