How to insert excel file into mysql database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • afroz ahmad
    New Member
    • Mar 2013
    • 18

    How to insert excel file into mysql database

    I want to import from excel sheet to mysql database through phpmyadmin importing option. I understand that we need to convert the format to csv format first before we can import to the phpmyadmin. But unfortunately if I change to csv some special character or symbol will become question mark (?) or other different character/symbol. Please advise me on this

    Thanks
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    You need to read up on character encoding. If you export your spreadsheet into CSV using, say, the UTF-8 charset, but then try to import that into a MySQL table set to use only standard ASCII characters, then you will have a problem like the one you are describing. - The Unicode character sets (including UTF-8) can store a lot more symbols than ASCII, so symbols outside the range of what ASCII can handle won't be stored properly.

    The MySQL documentation has detailed articles describing it's charset support. I'd start there.
    - 10.1. Character Set Support

    Comment

    • Ammu
      New Member
      • Aug 2011
      • 78

      #3

      It reads the binary format of XLS files directly

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        That's completely unnecessary, Ammu. It's far simpler to just save the Excel data as CSV and import it like that. PHP has great built in support for CSV, and it's an exceedingly simple format.

        Comment

        Working...