Definition and Usage
Write text to file allows you to write or append text to a file. If the specified file doesn't exist, it will be created automatically. This command is useful for generating log files, creating text documents, or updating existing files with new content.
Parameter Values
Input parameters
Parameter | Description | Possible Values | Required | Options / Notes |
File path | Specify the file path where the text will be written. If the file doesn't exist, it will be created automatically | - | Yes | You can use the "Select file" button to browse and select an existing file |
Content | Specify the content to write into the file | - | Yes | - |
If file exists | Specify the action to take if the file already exists: append the content or overwrite the file | Append, Overwrite | Yes | - |
File encoding | Select the encoding format for the file to ensure correct character representation | System default, Utf8, Ascii, Utf8WithBom, Unicode, GBK, GB2312 | Yes | - |
Error handling
Parameter Name | Description |
Throw error & stop | When an error occurs, the action will trigger an error and stop the execution of the entire app. |
Retry command | If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process. |
Ignore error & continue | When an error occurs, the action will be ignored, and the workflow will continue without interruption. |
Variables produced
This action doesn't produce any variables.
Using Variables in Conditions
You can use variables in the File path and Content parameters by clicking the {x} button or inserting a variable directly. This allows you to dynamically specify the file location or generate content based on previously captured or calculated values.
Notes
Make sure the application has appropriate permissions to write to the specified file location; otherwise, the operation may fail.
If writing to a file that is currently in use by another process, the operation might fail or be blocked.
When using special characters in content, ensure you select the appropriate file encoding to maintain proper character representation.
Using the "Append" option preserves existing content while adding new text at the end of the file; "Overwrite" replaces the entire file content.