save_working_file() method
Saves a file produced by a Python/HCL script to the Working data area where it is stored for future use, or for historical purposes.
Syntax
hcl.save_working_file(name = "working_file_name")
Parameters
Name | Description |
---|---|
name = working_file_name |
The name of the working file. The name must be enclosed by quotation marks. You must exactly replicate the name of the file that has already been produced by the Python/HCL script, including the file extension. working_file_name is case sensitive. You must match the case of the file name produced by the Python/HCL script. Note working_file_name is not case sensitive in the load_working_file() method. |
Returns
For success, the return code 202. For failure, an error message.
Examples
Save a file to the Working data area
You want to save a file with invoice records from Q1 2022 so that you can use it in subsequent analysis. The records are contained in a file named Invoices_Q1_2022.csv that you produce using a Python method earlier in a script. To permanently save the file to the Working data area in the robot, you need to use the separate HCL method save_working_file().
hcl.save_working_file(name = "Invoices_Q1_2022.csv")
Remarks
Working data area
The Working data area in a robot is accessible in two different locations in the Robots user interface:
-
The Working data tab
-
The Working data panel in the script editor
Both locations provide access to the same central data storage area in a robot. Actions you perform in one location are automatically synchronized in the other location.
File saving behavior
When you save a file to the Working data area it automatically overwrites any file with the same name and file extension, regardless of file name casing.
Script error message
Any of these situations produce the script error message shown below:
-
the specified file has not previously been produced by the script
-
the file name is misspelled
-
the case of the file name is not replicated exactly
-
the file extension is missing
Script error message:
FileNotFoundError: File working_file_name does not exists in the working directory