List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 27 2002 1:25pm
Subject:Re: Excel to MySQL
View as plain text  
At 3:58 -0800 3/27/02, Thomas Edison Jr. wrote:
>How do i import MS Excel Data into MySQL Tables??

One way: save it as a tab-delimited file, then import it
with mysqlimport.

If you don't want to mess around pointing and clicking to save
an Excel file as a tab-delimited file, try using this Perl script:

#! /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);


Run it like this:

from_excel.pl excel_file.xls > excel_file.txt

Spreadsheet::ParseExcel::Simple requires a few other modules that'll
need to be installed first.

>
>T. Edison jr.
>
>
>
>=====
>Rahul S. Johari (Director)
>******************************************
>Abraxas Technologies Inc.
>Homepage : http://www.abraxastech.com
>Email : abraxastech@stripped
>Tel : 91-4546512/4522124
>*******************************************

Thread
Excel to MySQLThomas Edison Jr.27 Mar
  • Re: Excel to MySQLPaul DuBois27 Mar