Writing to a text file

Hey I’m having trouble writing to a text file. I have 4 variables that need to be put in to a text file (str_Name, str_Role, str_PhoneNumber, str_RACF). Each time a case is processed it need to write a new line in the same file ie.

str_Name, str_Role, str_PhoneNumber, str_RACF
str_Name, str_Role, str_PhoneNumber, str_RACF
str_Name, str_Role, str_PhoneNumber, str_RACF
str_Name, str_Role, str_PhoneNumber, str_RACF

Atm, its overwriting the names rather than a in a new line.

If its not possible to do this in a text file how can I do this in a excel file?

Hi @S_N1

This is to be achieved through Append Line Activity.

And For excel You need to Build a Data Table first with column names and their Data Types and then use Add Data Row Activity to Add data to the data table row by row.

1 Like

Two ways.

Append each line to a string with line breaks
In the end, write the entire string to file.

If you want to do it in Excel, then
Create a DataTable with columns required using Build Data Table Activity

Add each row to that Data Table using Add Row activity

Finally use Write Range Activity to write entire Data Table to the Excel.

1 Like