Write to notepad

Hi, I am using read text file for reading txt file (with many lines) and I am appending some text stored in variable to line number 2 .And again I want to write same to the text file.

How can I work on write to text file part in this task.

Please help.

Thanks in advance,
Mohini Nemade

You want to write to the same file or another? @mohininemade301094

If you want to write to new, use write text file

if you want to write in same file, here are the steps :

  1. Use the same write file and save with the same name
  2. It will ask you to override the existing file, send the hot key as enter
  3. Manually click on OK within the attach browser


Try thisAppendTextFile.xaml (6.8 KB)

Hope this helps

Aman Sheik

Hi @mohininemade301094

Here is another example on writing to text files… Let know if it helps…

WriteToText.xaml (8.6 KB)

I want it to happen in background.


Same or another anything will do. I use write text file but it did not worked.
steps i am doing
Read text file → storing in string var
write text file → with stored string var
Reading all lines in array of string and assigning some value to line no. 2
after this I want to write text file with value assigned. but not able to write.

Can you share the workflow ? will rectify and send you back ,

Post the error if you are getting any @mohininemade301094

forumSeqNotepad.zip (1.4 KB)

here is the xaml and txt file.
write to text file that part is what I am looking for so that is not there in xaml.


forumSeqNotepad.zip (11.7 KB)

When I ran the file, the file has replaced the entire string in the notepad file, can you replace the notepad file with the one you sent in the previous one and try @mohininemade301094

1 Like

it is replacing whole file and only line no. 2 remains. :frowning:
I dont want to loose whole data

Yes @mohininemade301094,

That’s what you have designed in the workflow. I think you are trying it. So, do these steps,

Use Append Line activity


, Store the string in a variable and create a third variable and assigning the value of concatenating both the strings (entire data of the file + the data you want to concatenate) And then use write range activity with the new file

1 Like

Okay let me check with this!

Thanks for the help :slight_smile:

Will get back if it doesnt work.

Sure :slight_smile:

1 Like

append line is appending at start line only. that is not what i want.
and same happening for other solution as well. :frowning:

is there no chance that I can append to second line of notepad only and rest of data remains as is

You want to append to second line ? and the remaining data should be same?

Here are the steps :

  1. Split the text you have as firstLine = First line of text
  2. Second line into another variable
  3. Remaining data into another variable
  4. Then, append the text you want to the second variable and
  5. Finally, concatenate the first, second and the third variables which will give you the entire text you want :slight_smile:
1 Like

thanks ! works as a workaround

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.