Save File

Estimated reading: 3 minutes 106 views

The Save File component creates a file containing data produced by another component. Several file formats are supported, and you can store files in Robility flow storage or the local file system.

To configure the Save File component and use it in a flow, do the following:

1. Connect DataFrame, Data, or Message output from another component to the Save File component’s Input port.

You can connect the same output to multiple Save File components if you want to create multiple files, save the data in different file formats, or save files to multiple locations.

2. In File Name, enter a file name and an optional path.

The File Name parameter controls where the file is saved. It can contain a file name or an entire file path:

a. Default location: If you only provide a file name, then the file is stored in .robility flow/data.

b. Subdirectory: To store files in subdirectories, add the path to the File Name parameter. For example, subdirectory/my_file creates my_file in .robility flow/data/subdirectory. If a given subdirectory doesn’t already exist, Robility flow automatically creates it.

c. Absolute or relative path: To store files elsewhere in your .robility flow installation or the local file system, provide the absolute or relative path to the desired location. For example, ~/Desktop/my_file saves my_file to the desktop.

Don’t include an extension in the file name. If you do, the extension is treated as part of the file name; it has no impact on the File Format parameter.

3. In the component’s header menu, click Controls, select the desired file format, and then click Close.

The available File Format options depend on the input data type:

a. DataFrame can be saved to CSV (default), Excel (requires openpyxl custom dependency), JSON (fallback default), or Markdown.

b. Data can be saved to CSV, Excel (requires openpyxl custom dependency), JSON (default), or Markdown.

c. Message can be saved to TXT, JSON (default), or Markdown.

4. To test the Save File component, click Run component, and then click Inspect output to get the filepath where the file was saved.

The component’s literal output is a Message containing the original data type, the file name and extension, and the absolute filepath to the file based on the File Name parameter. For example:

DataFrame saved successfully as ‘my_file.csv’ at /Users/user.name/.robility flow/data/my_file.csv

If the File Name contains a subdirectory or other non-default path, this is reflected in the Message output. For example, a CSV file with the file name ~/Desktop/my_file could produce the following output:

DataFrame saved successfully as ‘/Users/user.name/Desktop/my_file.csv’ at /Users/user.name/Desktop/my_file.csv

5. Optional: If you want to use the saved file in a flow, you must use an API call or another component to retrieve the file from the given filepath.

Share this Doc

Save File

Or copy link

CONTENTS