CSV2Plings
From Plings Info
CSV2Plings is used for converting a spreadsheet following a predefined template to a Plings XML file that can be uploaded via the Plings Input API. An example of the correct spreadsheet format is included in the files for download.
Some of the spreadsheets supplied by local authorities, do not fit the correct template. For these the procedure has been to convert them from the original format to the plings spreadsheet format. See Spreadsheet conversion.
Contents |
Download
CSV2Plings is composed of multiple php files.
Download it:
- Git (preferred):
git clone git://gitorious.org/csv2plings/csv2plings.git csv2plings
- Csv2plings.tar.gz (14KB)
-
Csv2plings.zip (17KB)(Out of date.)
Changelog:
- 03/02/2010 - Various date fixes, add hol parameter
- 03/09/2009 - Fix category splitting, add custom fixes for Knowsley
- 30/07/2009 - Initial Upload
The most up to date code is also availible via the git repository at git://libreapps.com/plingsparse.git
Usage
A spreadsheet following the correct template (see data/example.xls) is saved as 4 separate spreadsheets with the local authority name followed by the suffixes _ar.csv (activities recurring), _a1.csv (activities one off), _v.csv (venues) and _o.csv (organisations). (See the example in data/).
These csv files are converted with by the parse.php script, with the parameter la as the local authority name (ie. the same as the filename prefix). For example, parse.php?la=example. The csvs are then parsed, and a Plings XMl file created in the out/ directory. If this works properly, the XMl file can then be pushed up to plings using this code.
Optional Paramaters
- v: Verbosity, this can be either 0 or 1. 0, the default shows only error messages where there is an error that prevents an activity being created in the xml. 1, meanwhile, also shows errors that have been corrected (missing fields) and activities in the past, in strike-through followed by what has been done to fix them.
- badv: Bad Venue support. This can be set to true if venues have been given as a comma separated address on the activity spreadsheet. (Do not encourage use of this).
- hol: Can be set to true to omit activities which fall during the school holdiays. So far this has only been used for Christmas 2009, with the dates hard coded into the code.
Notes
- All four spreadsheets must exist, but organisations are optional, and the venue sheet may not be used (see badv). In these cases, simply create an empty .csv file.

