How to convert an excel to MySQL database.

Discussion in 'MySQL' started by neriok, May 16, 2007.

  1. #1
    :(
    How to convert an excel to MySQL database,or if is posible,how to use from excel?
    May be is simle to have a access or .txt datbase?
    Have anyone a php code to make this connection with data base?
    I wont this code for telephony numertator(directory or desk-book).
    Please help me?
    Edit/Delete Message
     
    neriok, May 16, 2007 IP
  2. turiel

    turiel Peon

    Messages:
    148
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There are two simple steps to doing this.

    1) Save your Excel spreadsheet as a CSV file instead of an XLS file.

    2) Load this file into MySQL.
    http://dev.mysql.com/doc/refman/5.0/en/load-data.html (somewhat confusing, but full documentation)

    Basically, run this command from inside the MySQL client:
    LOAD DATA INFILE "/path/to/spreadsheet.csv" INTO TABLE example FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';

    What that means is load the file "spreadsheet.csv", parse it so that each field is seperated by a comma, and each record terminated by a newline, and then insert it into the "example" table.
     
    turiel, May 18, 2007 IP
  3. neriok

    neriok Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'll try it.
     
    neriok, May 24, 2007 IP
  4. mjesales

    mjesales Peon

    Messages:
    326
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you can probably also do it from phpmyadmin.

    Save the excel file as a .csv then do an import
     
    mjesales, May 28, 2007 IP