WriteToCSV

The WriteToCSV component writes data to a CSV file.

Screenshot

Ports

The WriteToCSV component exposes the Control In, Control Out, Data In, and Data Out ports by default.

Port Description
ControlIn Must be connected to the Control Out port of one or more components.
ControlOut Can be connected to the Control In port of another component or the default end component.
Data In The WriteToCSV component exposes the following Data In ports:
FilePath (string): specifies the location of the file to which data is written.
Data: specifies the DataTable to write to the file.
Delimiter:A type of data format in which each piece of data is separated by a comma.
Append(Boolean): specifies if the data should be appended to the existing text in the file. By default, the Boolean data type value is “False”. Therefore, the existing data is overwritten.If you want to append the new data, you can change the default Boolean value to “True”.

Properties

To edit the properties of the WriteToCSV component, in the Properties section, change the required property. You can edit the following properties.

Property Description
Search Search for the respective property.
Delay After Execution Specifies the wait time (in seconds) after the action is performed.
Delay Before Execution Specifies the wait time (in seconds) before the action is performed.

Example

Let us consider an example

Screenshot

To write data to a CSV file:

  1. Open Internet Explorer and type https://in.finance.yahoo.com/quote/AAPL?p=AAPL
  2. Locate the table as seen below.

    Screenshot

  3. In the Toolbox, expand Actions.

  4. Drag the GetTable component and drop it on the Design surface.
  5. To select the table to extract, click Screenshot.
    The Press “CTRL+SHIFT” for selection message is displayed.
  6. Press CTRL+SHIFT.
    The mouse pointer becomes a crosshair.
  7. Select the webpage content to extract.
    The selected content is displayed in the GetTable component.
  8. Set an Anchor by right clicking on the picture and select Add Anchor.
  9. In the Toolbox, expand Utilities and then expand Data Writer.
  10. Drag the WriteToCSV component and drop it on the Design surface.
  11. To specify the data to write to the file, double-click the data box.
    The PORT PROPERTIES dialog box is displayed.
  12. In Read Data From, select Connection.

    Note

    In Read Data From, you can select Static or Variable instead of Connection.
    To learn more about the Connection or Variable data source override options, refer the Override section.

  13. Click OK.
    The Design surface displays the process flow.

  14. To specify the file location, double-click the FilePath box and enter the required file path.

    Note

    You can override the existing data source for both the data and the FilePath Data In ports.
    To override the existing data source:

    • Right-click the required Data In port.
    • Click Override and change the data source.
      To learn more about overriding the data source of the data port, refer the Override section.

  15. To override the default Boolean value of the Append data port, right-click the Append box and proceed as follows:

    • Click Override.
      The PORT PROPERTIES dialog box is displayed.
    • In Read Data From, select Static.

    Note

    In Read Data From, you can select Connection or Variable instead of Static. To learn more about the Connection or Variable data source override options, refer the Override section.

    • In Static Value, click the drop-down arrow and select “False”.
    • Click OK.
      The Design surface displays the process flow.
  16. Connect all the control ports in the activity.

  17. In the toolbar, click Run.
    The data is written to the specified CSV file.