CSVAction

Summary: Adds a ?action=csv capability to pmwiki to output tables as a CSV
Version: 20140720
Prerequisites: PmWiki 2+, recent browser
Status: stable
Maintainer: Ccox
License: GPL2
Discussion: CSVAction-Talk?
Users: +1 (view / edit)

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.

Usage: http://your-pmwiki-page-path?action=csv

Installation

Get action-csv.phpΔ

  • copy the file "action-csv.php" to your pmwiki/cookbook directory
  • add to config.php such a line: include_once("$FarmD/cookbook/action-csv.php");

Notes

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

Contributors

  • Recipe written and maintained by Ccox.
  • XES - contribution

Comments

See discussion at CSVAction-Talk?

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.