RE: Excel to MySQL
| From: | Mikusch, Rita | Date: | Wed, 17 Oct 2001 16:05:16 +0000 |
| Subject: | RE: Excel to MySQL | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-13431@lists.php.net to get a copy of this message | ||
I do this fairly often (actually from MSSQL to Access to Excel to MySQL --
I'm sure there's a shorter route!)
I convert the Excel file to a tab delimited file. I do run into two
problems:
a) some of the text entries are surrounded by double quotes and some aren't
(some kind of Excel weirdness). So I open it up in a text editor and delete
all the quotes. I use the "programmers file editor" which is about a zillion
years old, hasn't been updated for years, but deletes those quotes in
milliseconds.
b) sometimes users enter hard-returns into the text data they enter into the
windows database (the source of my excel file). This will convert into a
hard return in your tab delimited text file. I run through the list manually
to find the hard returns and delete them. My list is only 10,000 long and it
is formatted in such a way that makes these hard returns easy to see! I'm
sure others on the list have a much better way of dealing with this.
I have an "auto increment" field in my table so I add an additional numbered
column in Excel and number it appropriately.
One day when I have time I'll actually find a more efficient way of doing
all this!
good-luck
rita.
-----Original Message-----
From: Chris Payne [mailto:chris@planetoxygene.com]
Sent: Tuesday, October 16, 2001 10:58 PM
To: php-db@lists.php.net
Subject: Excel to MySQL
Hi there everyone,
What is the best way to convert an Excel spreadsheet into a MySQL database?
Should I save it as a comma'd file or is there a better way? If I have to
save it as a comma'd text file, is there anything special I should do first?
I would normally enter the data manually on my server, but we are talking in
excess of 15000+ entries here which is way too many to add manually.
Thanks for all your help.
Chris