Skip to main content

Resources

Formatting and uploading CSVs to PHPMyAdmin

https://richardcarterorg.wordpress.com/2011/01/04/phpmyadmin-import-excel-csv-into-table/

Take spreadsheet of data import into Excel/Libra office or other spreadsheet program.
Remove any headings from the top, leaving just the data needed.

Open up the appropriate database and navigate to the table we are going to import to. If necessary, backup the contents, and then nuke it. Ensure there are an identical number of columns to the number present in the databse. If there are 15 in the database, there must be 15 in the spreadsheet. To check the number of columns, open up the table and click Structure at the top. If need be, insert empty columns into the spreadsheet to match the number of columns. It's okay to leave them blank if no data is present. 

If a column needs to be left blank, reomve any values in that column but do not delete the column itself. If the last column (farthest to the right) needs to be blank, simply insert a single comma into each row.

Finally, if there are dates present within the date, check the date format and match it to the date format present in the database. For example if the database formats the date like this:
2018-03-07 11:40:00
Then change any dates within the data to match this format. 

Now "Save As" the spreadsheet as a CSV format. Preferably a "Text CSV". 

Check to see if the data exported correctly by opening the new CSV in a text editor, Notepad++ or similar. 
If the final column in the spreadsheet had commas inserted into it's rows as previously mentioned, they shuold now have speech marks in them. These need to be cleared. 
Simply use the "Find and Replace" or just the "Replace" tool. Put a speech mark " into the find box, and leave the replace box blank. This will remove all the speechmarks in the final column. 
Save this file, make sure it remains a CSV. If your text editor doesn't support exporting or saving in a CSV format, then hit "Save As" and change "Save as type" to "All files". Name the file and append the filename with .csv
This will save it in a CSV format ready to be moved to the database. 
 

  • Hits: 690