Description and Usage
Adds a csv action to pages to allow easy export to CSV spreadsheet format of all tables on a page.
This recipes adds a ?action=csv capability to all page urls. When done, the output is streaming Comma-Separted Values that you can easily import into a spreadsheet. The recipe works off the HTML product of the page, so this works for simple tables or directives based tables (or even embedded HTML tables or tables from other recipes). For example, you could write a pagelist that produces tabular output on a page and use this to export to CSV.
- copy the file "action-csv.php" to your pmwiki/cookbook directory
- add to config.php such a line:
Not all pages will work as expected. This assumes that you have a pretty straightforward table representation on the page. Non breaking space markup is translated to space, other data is run through html_entity_decode, which defaults to UTF-8. (should I try to detect?)
Change log / Release notes
- 20120315 First release (but seems pretty stable.. let me know!)
- 20120318 Added doubling of double quotes, version data.
- 20140720 Changed mime/type to text/csv. Removed extra newline before "," produced by directive tables, probably needs same for last cell at end of record. XES