in reply to Import file into MySQL table

keep it simple.. save the excel sheet as a csv file, then have a look at LOAD DATA INFILE. As long as MySQL can read the file, an sql command such as this should do it:

mysql> LOAD DATA INFILE 'data.txt' INTO TABLE tbl_name -> FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' -> LINES TERMINATED BY '\n';

cheers,

J

Replies are listed 'Best First'.
Re: Re: Import file into MySQL table
by b310 (Scribe) on Jun 05, 2003 at 11:48 UTC
    Hello,

    I'll give this a try. Sounds pretty straightfoward. Thanks for the input.
Re: Re: Import file into MySQL table
by b310 (Scribe) on Jun 05, 2003 at 17:06 UTC
    Hi,

    I'm working on loading the data into a table. I'm receiving an error message that the text file cannot be located.

    Here's the exact statement I'm typing in that calls in the text file.

    mysql> LOAD DATA LOCAL INFILE 'C:\\Helen\\file.csv' INTO TABLE test

    The rest of the command is the same as you gave me. I've read through the MySQL book on how to read a local file and I'm not sure what's happening.

    Any ideas? Thanks.