Actually, these values come from reading an email and extracting the table data as text.
I’m currently trying to find the best approach for parsing the text and writing it into Excel.
Do you have any recommended method or best practice for handling this kind of data?
Use Read Text File activity to read the TXT content and split(Environment.NewLine) to convert text into lines.
Find the line containing “Account Bank” and start loop from next line using For Each:
If line is empty → stop the loop.
Else split the line values using spaces/tab.
Write data into Excel using Write Cell / Append Range.
As per your logic i created a workflow and output written in Sheet2 in same excel. Attached below check and let me know if it works. Testig.zip (225.9 KB)
If you find this helpful please mark it as solution
Happy Automation
Start reading the next lines until an empty line is found
Split each line using spaces/tabs/regex
Store data into a DataTable
Write the DataTable to Excel
Example logic:
lines = textContent.Split({Environment.NewLine}, StringSplitOptions.None)startRead = FalseFor Each line In lines If line.Contains("Account Bank") Then startRead = True Continue For End If If startRead Then If String.IsNullOrWhiteSpace(line) Then Exit For values = System.Text.RegularExpressions.Regex.Split(line.Trim,"\s+") 'Add values into DataTable row End IfNext
Using Regex.Split("\s+") helps when the spacing between values is inconsistent.
Finally, use Write Range to export the DataTable into Excel.
First, use Read Text File to get all content, then use Split by NewLine to convert it into an array of lines. Loop through each line and once you find the line containing “Account Bank”, set a flag to start reading. From the next line onwards, keep reading and split the values (using spaces or multiple spaces), then write them into Excel column by column. Keep adding rows for each group of data, and stop.
Then you need to identify the where the record is ending in the notepad based on that key or index you can split the data then you can write into in excel