Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSV Field Mapping GUI

Tags:

php

csv

I need to add one of these to a project. Is there an an open source PHP project made for this? Don't want to reinvent the wheel.

enter image description here

like image 983
jerrygarciuh Avatar asked Mar 22 '12 14:03

jerrygarciuh


People also ask

What is a column in CSV?

Values in a single column represent the same type of data. Therefore a CSV file represents a table of data (with rows and columns). The default delimiter for CSV files is the comma, but any symbol can be used as a CSV delimiter, for example, a horizontal tab.


2 Answers

Possible implementations of what you ask for include

  • Quick CSV import with visual mapping

    This a full implementation with a visual mapping, though it isn't themed like your picture. An example of usage is avaliable here

  • jQuery csv2table

    This is a partial implementation it converts csv to a html table data. The remaining part would be to convert the generated table to SQL with a visual mapping

The following items are PHP partial implementations that map csv to sql without providing a visual mapping to the user.

  • PHP csv2sql

  • PHP FileImporter

  • PHP csv2db

  • PHP csv-importer

  • PHP csv2mysql

  • PHP adv_csv

  • PHP csv

like image 146
Appleman1234 Avatar answered Sep 21 '22 06:09

Appleman1234


Sometimes reinventing the wheel is good, you get what you need, and what you need only

This seems easy, first you need a csv kinda parser, but that's just too easy you can do something like:

Your task may be break down in:

1.- Import the csv : (Build an upload form, handle file extension validation.

2.- Store the csv somewhere temporarily (Store file, probably with hash instead of name so no conflicts exist

3.- Parse the csv. (http://php.net/manual/en/function.fgetcsv.php will be your friend)

4.- Two input fields, one for the parsed files and one for your map, use some sessions/javascript fancyness for adding the right columns on the fly

5.- Then store the mapped columns to real csv values.

like image 45
Carlos Barbosa Avatar answered Sep 22 '22 06:09

Carlos Barbosa