Does anyone know of an online CSV editor written in PHP that will allow a user to open, edit, and save a given CSV file?
All I can find are CSV classes and nothing that can handle dynamic files, just predefined lengths etc.
Parse the CSV file into array. Then, use an array of arrays to populate a matrix of text boxes in your web page. When you submit the form, read the data from $_POST
and use fputcsv()
to save it.
Think about validation, if relevant.
So you want to be able to open a file, edit it using a web based UI and save it? Why not use Google Docs?
EDIT: Its irritating when people vote you down without leaving a comment as to why... Useless contributions...
fgetcsv
would solve your issue. Basically it takes in CSV file and parses it out into an array.
http://www.phpclasses.org/package/2124-PHP-Retrieve-or-change-information-stored-in-CSV-files.html
Point it at a csv, tell it the delimiter, unique field and tell it to edit. Very simple to use. I've had an issue with the delete button but I only just tried it for the first time, I'm sure I can work that out.
Saved me some hours trying to build and test my own.
Edit: Worked out the issue with the unique column (or KeyFieldName as he calls it) don't have spaces in the name of that column (the first row of the csv)