SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to import excel file into mysql using php

    Hi Friends,
    I am having an excel file contianing all employees' skill set details. I have to read the file and insert the skills of the employees into the database using php.
    Could any one pls help me in fixing this issue.

    Regards,
    KISHORE

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    US
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'd be better off resaving the Excel worksheet as a CSV file then importing it with the LOAD DATA INFILE MySQL statement.
    webmaster at zeroweb dot org
    Free webmaster stuff | URL shortener | Free web graphics

  3. #3
    SitePoint Wizard triexa's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    2,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Definitely convert to CSV first

    then, file() the file.. each line in a new array index.

    each line's columns are going to be separated by commas (by default) so explode() the line with this, and then you have each column in a diff index... and from there, parse it as you need to parse it.
    AskItOnline.com - Need answers? Ask it online.
    Create powerful online surveys with ease in minutes!
    Sign up for your FREE account today!
    Follow us on Twitter

  4. #4
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're only reading in one spreadsheet, convert this to CSV first then import as already described.

    For anyone who simply must load a spreadsheet, check out Vadim Tkachenko's PHP Excel Reader.

    I've had clients who needed to frequently upload spreadsheets, and this worked very well.


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
  •