How to Change CSV Export Delimiter

Overview

Would you like to change the CSV export delimiter from a comma to something else? WPForms makes this super simple and all you need is a bit of PHP. This tutorial will walk you through how you would change the default , to something else for exporting your form entries.

By default, CSV exports of WPForms entry data will be separated by a comma. However, some systems that accept CSV data may require an alternate delimiter format.

Setup

In the example below, we’ll be modifying the CSV separator symbol to be a semicolon instead of a comma.

Just add the following code to your site.

/**
 * Filters the delimiter used in CSV exports of form entries.
 * 
 * @link https://wpforms.com/developers/change-csv-export-delimiter/
 *
 */

function wpf_dev_pro_admin_entries_export_configuration( $configuration ) {

	$configuration['csv_export_separator'] = ';';
        return $configuration;

}

add_filter( 'wpforms_pro_admin_entries_export_configuration', 'wpf_dev_pro_admin_entries_export_configuration', 10, 1 );

Changing the CSV delimiter from a comma to a semicolon

And that’s it! You’ve successfully changed the delimiter! Would you like to know how to display a count of how many visitors have completed your form? Take a look at our article on How to Display Entry Submissions Count for a Specific Form.

Filter reference: wpforms_pro_admin_entries_export_configuration

FAQ

Q: Can the export data for an address be on separate lines?

A: Absolutely! Certain fields such as Address, Checkbox, and Likert Scale you can force the export to show each option on a new line by using this code.

/**
 * Filters the delimiter used in CSV exports of form entries.
 * 
 * @link https://wpforms.com/developers/change-csv-export-delimiter/
 *
 */

function wpf_dev_pro_admin_entries_export_ajax_get_data( $export_data, $request_data ) {
 
         array_walk(
         $export_data,
         static function( &$row ) {
            $row = str_replace( "\n", ' ', $row );
         }
      );
 
    return $export_data;
 
}
add_filter( 'wpforms_pro_admin_entries_export_ajax_get_data', 'wpf_dev_pro_admin_entries_export_ajax_get_data', 10, 2 );