Unable to read a large text file

Hi,

Im having an issue while trying to read a large txt file.
I tried to use the read text file activity and it worked but the output string was incomplete.

File has 123 lines and the output only has 84.

String variable last row:

I also tried this: File.ReadAllLines(txt path.ToString).ToList() but the result was exactly the same.

Please, I need help with this, I need to get all the lines.

Hi @Gabriel_Alcaraz
welcome to forum

are u checking this in local panel while debugging?

1 Like

Hi @Gabriel_Alcaraz,

I think your are using a Log Message activity. The characters are limited when you use Log Message activity. You should have all lines in your string variable. It is just the visual output of the variable is limited to a certain number of characters in UiPath. In short, your string variable has all the lines, not to worry.

This is also similar in any other programming language. The reason for this is to give the user a taste of the output and not the entire output. For example if someone tried to Log 100000 lines, the debugger will have to both process and display 100000 lines. So they limit characters in terminal / console outputs.

To check if all lines exist:

Approach 1. Try using Write to Text File activity and pass your string variable as text value. Provide a dummy text file name “TestingOutputs.txt” → Open text file and you should see the same text as your other input file.

Approach 2. Use a Message box activity and use the following YourInputString.Split(Environment.NewLine.TocharArray).Count
YourInputString ( The one you have already read from the textfile). You should see the same line counts (123 in this case)

3 Likes

Thank you so much for your quick answer, you were right, it was just that the visual output has a limited number of lines to show.

I’m so sorry for bother you, I’m new on using UIPath.
Have a good day :hugs:

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