Close

Results 1 to 5 of 5
  1. #1
    DF VIP Member ParkerDigital's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    455
    Thanks
    0
    Thanked:        0
    Karma Level
    238

    Question Importing Excel spreadsheet into MySQL database

    How do I do this? I know that the columns in the spreadsheet need to match the fields in the MySQL table, but what do I do to actually move the data across?

  2. #2
    DF VIP Member /dev/null's Avatar
    Join Date
    Feb 2004
    Location
    Behind You
    Posts
    2,952
    Thanks
    0
    Thanked:        0
    Karma Level
    450

    Default Re: Importing Excel spreadsheet into MySQL database

    Export the excel file as CVS or TXT then import it using the LOAD command:

    Code:
    LOAD DATA INFILE './dir/file.cvs' INTO TABLE table_name;

  3. #3
    DF VIP Member ParkerDigital's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    455
    Thanks
    0
    Thanked:        0
    Karma Level
    238

    Default Re: Importing Excel spreadsheet into MySQL database

    Cheers for that John :-)

  4. #4
    DF VIP Member ParkerDigital's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    455
    Thanks
    0
    Thanked:        0
    Karma Level
    238

    Default Re: Importing Excel spreadsheet into MySQL database

    Quote Originally Posted by John Keymer View Post
    Export the excel file as CVS or TXT then import it using the LOAD command:

    Code:
    LOAD DATA INFILE './dir/file.cvs' INTO TABLE table_name;
    Ah, one thing - if I'm using a text/cvs file that's on my PC, how do I upload it, and where should I put it on the server?

  5. #5
    DF VIP Member /dev/null's Avatar
    Join Date
    Feb 2004
    Location
    Behind You
    Posts
    2,952
    Thanks
    0
    Thanked:        0
    Karma Level
    450

    Default Re: Importing Excel spreadsheet into MySQL database

    If it's on the server then use an absolute path, ie: /var/www/public_html/myfile.txt and obviously upload it to that location.
    You can also use the LOCAL keyword if you are using a client-side sql query tool.

    The following page should help you out:
    http://dev.mysql.com/doc/refman/5.0/en/load-data.html

Similar Threads

  1. excel for fee
    By bobbobb in forum Programming
    Replies: 8
    Last Post: 7th March 2005, 11:22 PM
  2. PHP & MySQL
    By g1bbo in forum Website Coding & Graphics
    Replies: 6
    Last Post: 20th December 2002, 05:34 PM
  3. Excel graph problem
    By marktb in forum PC Problems
    Replies: 2
    Last Post: 9th October 2002, 04:42 PM
  4. Mp3 Database
    By CoLBuRN2 in forum The Dog and Duck
    Replies: 4
    Last Post: 23rd September 2002, 07:46 PM
  5. fix the database error
    By 01000101 in forum Forum Suggestions & Feedback
    Replies: 0
    Last Post: 19th September 2002, 05:18 AM

Social Networking Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •