Support » Plugin: Flamingo » Problems with CSV export function

  • blogeescht

    (@blogeescht)


    Hi, after using the Flamingo export function I try to import the data into Excel by using the Excel Data Import function From Text. As a delimiter I define the comma as it is used as such in the exported Flamingo .csv file. Unfortunately everytime the text entries in the field “your-message” contains a line break or a comma, this puts the rest of the message in the next Excel row, so this breaks my entire Excel data sheet. As File origin settings in Excel I have chosen UTF-8 to display special characters used in the Contact Form 7 entry fields correctly, does this have something to do with my broken Excel data sheet or should Flamingo be fixed to create a clean .csv-file?
    Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can add this code $input = preg_replace(“/\r\n|\r|\n/”,’ ‘,$input); in /flamingo/includes/csv.php into function flamingo_csv_row()

    function flamingo_csv_row( $inputs = array() ) {
    	$row = array();
    	foreach ( $inputs as $input ) {
    		$input = preg_replace("/\r\n|\r|\n/",' ',$input); /*ADD THIS*/
    		$row[] = apply_filters( 'flamingo_csv_quotation', $input );
    	}
    
    	$separator = apply_filters( 'flamingo_csv_value_separator', ',' );
    
    	return implode( $separator, $row );
    }

    Be careful, file is replace with update

    To flamingo team : is it possible to add this fix in the new release?

    @metfabequipment You don’t need to replace this code in the plugin!!

    Ik had the same problem, but you can fix this with a filter. Add the following code to the functions.php of your theme and the replace is done in a filter. Export works great after that and newlines are replaced with a space, so the whole record is on one line.

    
    function sln_content_export($input) {
    	return preg_replace("/\r\n|\r|\n/",' ',$input); 
    }
    add_filter('flamingo_csv_quotation', 'sln_content_export', 999);
    

    Adding semicolon ; instead of comma , did the trick for me on line 10

    $separator = apply_filters( 'flamingo_csv_value_separator', ';' );

    • This reply was modified 6 months, 3 weeks ago by kris5873.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problems with CSV export function’ is closed to new replies.