Write to txt file
-
How do I write something to a text file (and create the file if not already created) using OpenRPA? Also, how do I "append" or "overwrite" while writing in that text file?
-
add an "invoke code" activity.
lets assume you have a variable called stringcontent with the content you want to write or append to the file, thenTo overwrite a file use
System.IO.File.WriteAllText("c:\myfile.txt", stringcontent)
and to appened to an existing file
System.IO.File.AppendAllText("c:\myfile.txt", stringcontent)
To read more go here, and then expand the "methods" section in the side menu.
For instance here you will also find Exists, to check if a file exists. You can use this in the expression part of an If acitvity, or inside invoke codeSystem.IO.File.Exists("c:\myfile.txt")
-
This post is deleted!