Add ability to export CSV as raw or formatted

The title pretty much sums it up.

Closes #2341.