Skip to main content

Add-to-File

Command Description

Append to a file, and insert the content to the end of the file without overwriting the original file content

Command Prototype

File.Append(sPath,sText,sCharset)

Parameter Description

ParameterRequiredTypeDefaultDescription
sPathTruepath'''C:\Users'''The path of the file that needs to be written. You can fill in the absolute path or use the @res "path" form to indicate the path under the res folder of the current process. The path separator must be escaped, such as "C:\Laiye RPA" or @res"Laiye RPA \Laiye RPA"
sTextTruestring""The file content to write
sCharsetTrueenum"gbk"The file encode is automatically determined when it is passed as "auto", ANSI code when it is passed as "ANSI", UTF-8 code when it is passed as "utf8", and utf-16 code when it is passed as "Unicode"

Demo

/********************************Append to file ************* ************************ 
Command prototype:
File.Append('''C:\Users''',"","gbk")
Input parameters:
sPath--the file path to be written
sTest--file content written
sCharset--file character set encoding
Outgoing parameters:
None
********************************************************************************/
Dim sPath='''C:\Users\Chance\Desktop\testFile\data.txt'''
Dim sText="RPA"
File.Append(sPath,sText,"gbk")