As an alternative to the 2 modules you're using, you could also try to use the Forena module (Disclosure: I'm a co-maintainer of it). Here is a quote from that page:
... built of the idea of using SQL to get data out of a database and use XHTML and CSS to format it into web reports.
And here is another quote from Reasons for considering Forena, related to the "CSV" in the question here:
Reports created by Forena ... can be saved (exported) as PDF documents with embedded graphs. Other supported formats for saving a report are CSV, XLS, DOC, HTML, etc.
These are the steps for creating such CSV files are:
Create a custom SQL query, in which you have the full power of SQL at your fingertips (and various extra features related to it provided by Forena).
Here is a (basic) SQL I'd use for answering this question:
SELECT nid, title, type, uid
Create a custom report, either by an admin, or by just any regular user who is either familiar with creating what is called 'FRX files', or otherwise using the WYSIWYG report editor.
Using the WYSIWIG editor, in about 10 secs (= a few mouse clicks later on) you'd have a report for which the layout (in XHTML) would look like this:
<div id="nodes_block" class="FrxTable FrxTable" frx:block="drupal_cust/nodes">List of all nodes in this site
<tr id="nodes" frx:foreach="*">
As part of "designing" this report, you should enable (within what is called "Document types") the option to export to CSV files (possible other options like XLS, DOC, PDF, etc also if appropriate).
At then end just "Save" the design of such report. This will be used later on, to retrieve all the specs of your report, when you want to browse (run, execute) your report.
Browse the report (= enter its relative path, or click some menu link if your design included such link) and then use the CSV link in it to actually save (= export) the report in (eg) CSV format.
Note: These steps do not require any PHP coding.
Bonus: instead of CSV format, you also have an option to format it as either XML or JSON. For more details on that, refer to "How to add a link to the CSV download to my module page, for a report created with Forena?".
Here is an example of (part of) a CSV file I created using the above approach:
39,"Demo, with some commas in the title, just a test",article,1
72,Yet some other Article,article,8
73,Article with some field collection data,article
The above CSV file contains:
- the typical CSV header in record 1 of it, whereas the values in this record correspond with what was requested in the report design, as specified with the
<th>...</th> tags in the report layout.
- 1 record for each result that was selected.
- 1 specific record with a node title containing commas (shown with surrounding
For more info (prior to installing/testing Forena), checkout these links: