Skip to main content

Remove Extra Blank Spaces from Fields in Export

On occasion, fields may contain unwanted spaces before or after the relevant data. This may be due to applicant data entry errors, or inadvertent spacing in multiple choice options. If you are importing data into another system, you may need to remove these extra spaces. The JavaScript configuration below allows you to strip the leading or following blank spaces, leaving you with a usable export file.

Setting Up the Export

To complete this configuration, you'll need to add a Calculated Field to a Tabular/Spreadsheet Export. You can do this while configuring your Export by dragging a Calculated Field into the Columns to export.


After dropping in the Calculated Field, use the JavaScript Expressions option by dropping the code listed below into the Expression field. Then, update the code to indicate which field you are exporting.

JavaScript Code

After following the steps above, use the following code in your JavaScript Expression. (Use the view source icon at the top right to copy the code snippet.)

  let field =;
  if(typeof field != "undefined" && field != null){
      return field.trim();
    return "";

Modify the Code

Once you've added this code into your JavaScript expression, you'll need to modify it in the following ways:

  1. Indicate which field you want to strip the blank spaces from. Use the Field Dictionary to find the name of the field you want to use, and update the let field = line, replacing accordingly.

  2. In the example above, the field is used. The resulting field, Program Name Revised, will have any leading or trailing blank spaces removed in the export. After modifying the JavaScript Expression, click Update.
  3. If there are other fields you need to remove blank spaces from, continue adding Calculated Fields and repeat the steps described above. Then run your export.
  • Was this article helpful?