Jump to content

Importing an .xlsx file to a MySQL Database by using phpMyAdmin


mdm37

Recommended Posts

You can certainly convert it from Excel to csv easily enough, but you need csv to import, so if you can have that instead it saves you some complications.  The important thing with csv is that your string columns need to be surrounded by double quotes so that commas inside a string don't confuse the parsing. This also necessitates that if you have double quotes in the string, the double quotes have to be doubled in order to escape them.

 

Excel export to csv should do this for you, so ultimately it's up to you if the excel has value outside of the import, or if getting a .csv version is more trouble than it's worth.

Link to comment
Share on other sites

I would use the csv. Plus you have to look at the layout closely to be sure that it works in a database format instead of a spreadsheet one. Is the data normalized as it is now?

 

 

You can certainly convert it from Excel to csv easily enough, but you need csv to import, so if you can have that instead it saves you some complications.  The important thing with csv is that your string columns need to be surrounded by double quotes so that commas inside a string don't confuse the parsing. This also necessitates that if you have double quotes in the string, the double quotes have to be doubled in order to escape them.

 

Excel export to csv should do this for you, so ultimately it's up to you if the excel has value outside of the import, or if getting a .csv version is more trouble than it's worth.

 

Great, thank you!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.