Appending CSV File Using String Builder
  • 20 Feb 2025
  • 3 Minutes to read
  • Dark
    Light

Appending CSV File Using String Builder

  • Dark
    Light

Article summary

Overview

Appending CSV Files into Text using a Flow requires a few steps, known as String Builder steps, to get the data from the file and then create the required information. 


Example

The following example will demonstrate how to append text to a CSV file using the String Builder steps.

Before proceeding with the example, download the CSV File:
  1. From a Designer Project, click CREATE FLOW on the Global Action Bar and select Flow. Provide a Name and click CREATE. 
  2. From the Flow Designer, attach a Create Data step to the Start step from the FAVORITE STEPS category of the Toolbox panel. 
  3. On the Properties panel under the DATA category, click SHOW EDITOR under the Data To Create field. 
  4. From the Data Definitions window, enter "File" under NAME and select FileData as the TYPE. Under Input, Constant map the desired CSV File. Click Save and close the window.
  5. In the Toolbox panel, navigate to DATA > TEXT > STRING BUILDER and attach a Create String Builder step to the Create Data step.
  6. In the Toolbox panel, under DATA > TEXT, attach a Get String From Bytes step to the Create String Builder step. On the Properties panel, map File.Contents to the Bytes field under INPUTS.  
    The Get String From Bytes step is used to convert the CSV File's Contents into a String Output.

  7. In the Toolbox panel, under DATA > TEXT > STRING BUILDER, attach an Append Line step to the Get String From Bytes step. On the Properties panel under the INPUTS category, map CreateStringBuilder1_Output to the String Builder field, and GetStringFromBytes1_Output to the Line To Add field.
  8. Attach a Show Form step from the FAVORITE STEPS category to the Append Line step. On the Properties panel, click PICK OR CREATE FORM and select Form. Provide a Name and CREATE.
  9. From the Form Designer, configure the Form to contain a Text Box Multi Line component (NewRows) and a Button (Done) component. Click Save and close the Form.
  10. Back in Flow Designer, set the New Rows Input on the Form step to Ignore.
  11. Attach an Append Text step from DATA > TEXT > STRING BUILDER to the Form step. From the Properties panel, map CreateStringBuilder1_Output to String Builder and New Rows to Text To Add.
  12. From the DATA > TEXT category of the Toolbox, attach a To Text step to the Append Text step. From the To Text step's Properties tab, map CreateStringBuilder1_Output to String Builder. 
    The To Text step is used to retrieve data from the String Builder.

  13. From the same category of the Toolbox tab, attach a Get Bytes From String step to the To Text step; map ToText1_Output to the Str Input. 
    The Get Bytes From String step is used to convert the To Text step's output into a Byte Array that may be used as contents for the appended CSV file. 

  14. Attach another Show Form step to the Get Bytes From String step. From its Properties tab, select PICK OR CREATE FORM and CREATE a new Form. 
  15. Configure the Form with a Button component and a File Download component. From the Properties panel under the COMMON PROPERTIES category set the Select Button Type field to Button. Click Save and close the Form Designer.
  16. Back in the Flow Designer, connect the Done path to the End step.
  17. Select the Show Form step (for the Download Form) and select Build Data for the mapping type for the Download File field. Constant map a FileName and map GetBytesFromString1_Output to Contents. Click Save to save changes to the Flow.
    When defining the FileName, add .csv to the end to ensure that the file saves as a CSV file. 


Debug

  1. Click Debug from the top action bar.
  2. Click START DEBUGGING. 
  3. When the Flow reaches the Form step, enter "First Name, Last Name, Email" and click Done.
    Separating the row by commas places each text value in a separate cell on the spreadsheet. 

  4. Upon reaching the second Form, click the Download button then open the CSV file to ensure that it contains the newly input row of text. 




For further information on Flows, visit the Decisions Forum.

Was this article helpful?