CSV Import

Categories

Component ID

2428627

Component name

CSV Import

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Overview
This module has been created to give a site admin's access to directly import a CSV file to a MySQL database table.

About
Currently the PDO layer for mysql does not have the drivers for running a query with 'LOAD DATA INFILE.'
This module takes advantage of mysqli_connect to perform this operation

Installation

  • Install like a normal module
  • You will need to update the Drupal database user's permissions to have FILE.
  • E.g. GRANT FILE ON * . * TO 'username'@'localhost' IDENTIFIED BY 'password' ;
  • Go to the configuration page and update with your table name and other CSV paramaters.
  • Don't for get to set the permissions

Configuration Page

  • admin/config/csv-importer

Notes
When inserting into the database the mysqli_connect use the default database

Credits
This is a port over from a class on phpclasses.org
Source: http://www.phpclasses.org/package/2917-PHP-Import-CSV-data-into-a-MySQL-...