PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Returns in Textarea causing problems in csv export

  1. I am having an issue when I import Gravity Forms csv forms into Excel. The form I created uses multiple textarea fields. If a return is entered into a textarea, i.e more than one paragraph is added, when I import the csv data into Excel, the return is interpreted as a line break. This messes up my columns quite a bit!

    Is there a way of filtering for returns and replacing or deleting them? Or a way of preventing certain characters from being allowed in a textarea field?

    Thank you!

    Posted 11 years ago on Thursday May 16, 2013 | Permalink
  2. Hi,
    You can remove the returns before the data is saved to the database with the following script:

    add_filter("gform_save_field_value", "save_field_value", 10, 4);
    	function save_field_value($value, $lead, $field, $form){
    		$new_value = str_replace(array("\n", "\t", "\r"), '', $value);
    		return $new_value;
    	}

    \n removes new lines
    \t removes tabs
    \r remove carriage returns

    Posted 11 years ago on Friday May 24, 2013 | Permalink