How to import .csv files in the database from phpmyadmin
You have to keep in mind few things to import successfully .csv files within the database from phpmyadmin. Make sure that you save your Excel file as a csv file. Please don’t save it as a workbook or the other format, check it with a text reader like notepad or similar. You’ll be able to see that every column is separated by a comma (,). this is often needed when we import the file with PHPmyAdmin. Please take away column headings, blank areas and make sure that there’s an entry of some kind in every row and column. the information within the table should represent identically within the CSV file. If your table has ‘n’ columns you need to have ‘n’ columns within the CSV file as well.
Follow the steps as given below in order to import .CSV file into database.
1. Using ftp Upload .csv file in public_html .
2. Access your phpmyadmin >> Choose database >> Click on SQL tab.
3. Type the SQL query as follow:
Into table city load data local in file ‘Full path for .CSV file’
fields terminated by ‘,’
enclosed by ‘”‘
lines terminated by ‘\n’
Then actual full path should be replaced with “Full path for .CSV file” (/home/username/public_html/filename.csv)
4. Then Click on Go.