Title: CSV export customization
Last modified: November 11, 2021

---

# CSV export customization

 *  Resolved [ranone](https://wordpress.org/support/users/ranone/)
 * (@ranone)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/)
 * Hi, I’m trying to make the export csv data as readable as possible…
 * I have 2 questions:
 * 1) is there the possibility to put the complete url instead of just the name 
   for the file upload fields? (for example [https://domain.com/location-to-pdb-upload-dir/filename.ext](https://domain.com/location-to-pdb-upload-dir/filename.ext))
 * 2) is there the possibility of using the ‘title’ instead of the ‘name’ as the
   headers of the CSV file?
 * Thanks a lot

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15059696)
 * Yes, it’s possible, but it is important to understand that doing either of these
   things will result in a CSV that cannot be imported back in to Participants Database
   because it breaks the expected format.
 * It is possible to add custom code that modifies the exported value using the _
   [pdb-csv\_export\_value](https://xnau.com/work/wordpress-plugins/participants-database/participants-database-documentation/participants-database-api/#csv-import/export)_
   filter. That filter gets two arguments: the value that is getting exported and
   the PDb_Field_Item object for the exporting field. The filter expects in return
   the value to be exported. You can use that filter to convert the filename to 
   the complete URL on export.
 * For the field titles, there is a checkbox in the Export CSV interface to include
   the field titles in the exported CSV.
 * If you want to import this back in to Participants Database, you’ll need to make
   sure the row with the field titles is not included.
    -  This reply was modified 4 years, 6 months ago by [xnau webdesign](https://wordpress.org/support/users/xnau/).
 *  Thread Starter [ranone](https://wordpress.org/support/users/ranone/)
 * (@ranone)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15061321)
 * Tks [@xnau](https://wordpress.org/support/users/xnau/) for your reply..
 * For the CSV Export I pass in the frontend template with csv_export_form() function,
   is there a possibility to write something here? (Not in back office interface)
 * Then I have another connected question…
 * In the csv_export_form() function I really need to pass groups names instead 
   of fields names (for example export_groups instead of export_fields).
 * Is it possible to do a hack?
 * Listing all the fields is impossible for me because I have available only a variable
   that I can use which is the group name…
 * Tks a lot
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15063023)
 * The frontend CSV export passes through the same filter, so the same code will
   work there too.
 * Groups? No, not possible, the export goes field by field, it ignores groups entirely.
 *  Thread Starter [ranone](https://wordpress.org/support/users/ranone/)
 * (@ranone)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15064142)
 * Hi,
    is there a method that gives me the names of all the fields of a group in
   a simple way?
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15065337)
 * There is no public method specifically for this, but you can use a function like
   this:
 *     ```
       <?php
       function pdb_get_group_fields( $name ) {
         global $wpdb;
         $result = $wpdb->get_col( $wpdb->prepare( 'SELECT f.name FROM ' . Participants_Db::$fields_table . ' f WHERE f.group = %s', $name ) );
   
         return $result;
       }
       ?>
       ```
   
 * That will give you an array of field names.
    -  This reply was modified 4 years, 6 months ago by [xnau webdesign](https://wordpress.org/support/users/xnau/).
 *  Thread Starter [ranone](https://wordpress.org/support/users/ranone/)
 * (@ranone)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15082277)
 * I’m sorry, but the $fields_table variable what should it be?
 * In the CSV export I have fields that seems to be cached from previous queries…
   Is there any way to reset and perform a new query?
 * Tks a lot
    -  This reply was modified 4 years, 6 months ago by [ranone](https://wordpress.org/support/users/ranone/).
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15082549)
 * You don’t need to set the $fields_table variable, just use `Participants_Db::
   $fields_table` the plugin provides the value.
 * The CSV export uses the last query use to generate the list, so you just need
   to redisplay the list. Of course, make sure there is no page caching if you are
   on the frontend.
 *  Thread Starter [ranone](https://wordpress.org/support/users/ranone/)
 * (@ranone)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15084141)
 * From a further check I have found that the result of the query on the database
   is correct.
 * The problem is when I pass this result to the csv_export_form() function in the
   export_fields parameter.
 * The result in the CSV strangely includes other fields from other groups … I am
   doing some further testing, but it’s very strange…
 * Is there a way to clean cache in pdb-list template before include csv_export_form()
   function?
 * Tks
    -  This reply was modified 4 years, 6 months ago by [ranone](https://wordpress.org/support/users/ranone/).
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15087057)
 * Make sure you’re providing the data to the function in the correct format.
 *  Thread Starter [ranone](https://wordpress.org/support/users/ranone/)
 * (@ranone)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15090166)
 * I pass the result of the pdb_get_group_fields() function which I have verified
   to be an array…
 * This array is correct as result extrapolated from database.
 * The file CSV returned by csv_export_form() function is however incorrect because
   it shows fields not passed to the export_fields parameter..
    -  This reply was modified 4 years, 6 months ago by [ranone](https://wordpress.org/support/users/ranone/).
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15090317)
 * Make sure it’s just an array of field names.
 * This is working here, so we need to make sure it’s getting configured correctly.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘CSV export customization’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

## Tags

 * [csv](https://wordpress.org/support/topic-tag/csv/)

 * 11 replies
 * 2 participants
 * Last reply from: [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/csv-export-customization/#post-15090317)
 * Status: resolved