Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

bradstinson/csv-import

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CSV Import [DEPRECATED]

CSV Import is a Codeigniter spark which makes it easy to import a CSV file into an associative array.

NOTE: I've not used this code in about 3 years, and will no longer offer any type of support. However, feel free to use this code at your own risk.

Usage

First you must load the csvimport spark:

$this->load->spark('csvimport/0.0.1')

To import a file, simply run the following command:

$this->csvimport->get_array('test.csv');

It is important to note that this library treats the first row of a CSV file as a column header row.

If you would like to use a different set of column headers, other than what is generated by the file, you submit them as an array.

$this->csvimport->get_array('test.csv', array('id', 'name', 'company', 'phone'));

Warning The function assumes that the number of column headers will match the number of values in each row.

For mac formatted csv files, you will need to specify for the library to auto detect line endings. Thanks to Ryan Mueller for this patch.

$this->csvimport->get_array('test.csv', "", TRUE);

About

Import a CSV file into an associative array

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages