itxrahulsingh's avatar

upload csv to mysql selected columns only - laravel

Want to upload CSV file into MySQL Database, upload only selected columns other will be blank when the upload has an option to select the column or field want to upload and upload only selected, how can I do that anybody has any solution

0 likes
3 replies
bobbybouwmann's avatar

I know PHPMyAdmin, for example, has a feature where you can upload a CSV file into a table. However, I'm not sure if you can pick certain columns.

If you really need to pick custom columns, it might be better to build this yourself as well. So you build an upload form that shows which columns are present and based on the selected columns you create an insert query for the data. You can easily do this with Laravel as well ;)

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

itxrahulsingh's avatar

how can I do that, I have 15 fields but when upload data upload only 7 selected fields through csv file into database

bobbybouwmann's avatar

I guess the header fields need to match the column name in the database as well.

Please or to participate in this conversation.