Hi @Gonza1 I hope you are doing well.
The problem that I’m seeing is that the variable %FileContents2% is a list and you are using this list to save the Excel File, for this reason the error is showing the whole list of archivos.
You need to use a For each Action into another For Each Action to solve this, and into the second for each you need to delete the first item of the list and then exit the second loop.
Here is the snipped code:
File.ReadTextFromFile.ReadTextAsList File: $'''D:\\User\\wsanchez\\Course RPA\\Read From TXT Notepad\\Robot TEST 2.txt''' Encoding: File.TextFileEncoding.UTF8 Contents=> FileContents
File.ReadTextFromFile.ReadTextAsList File: $'''D:\\User\\wsanchez\\Course RPA\\Read From TXT Notepad\\Robot TEST.txt''' Encoding: File.TextFileEncoding.UTF8 Contents=> FileContents2
LOOP FOREACH CurrentItem IN FileContents
WebAutomation.LaunchChrome.LaunchChrome Url: CurrentItem WindowState: WebAutomation.BrowserWindowState.Normal ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 BrowserInstance=> Browser
WebAutomation.ExtractData.ExtractListInExcel BrowserInstance: Browser Control: $'''html > body > div:eq(2) > div > header > div:eq(4) > div > div:eq(4) > table > tbody > tr:eq(0) > td''' ExtractionParameters: {[$'''''', $'''Own Text''', $''''''] } PostProcessData: False TimeoutInSeconds: 60 ExcelInstance=> ExcelInstance
WebAutomation.CloseWebBrowser BrowserInstance: Browser
LOOP FOREACH CurrentItem2 IN FileContents2
Display.ShowMessageDialog.ShowMessage Message: CurrentItem2 Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed2
Excel.ResizeColumnsOrRows.AutofitAllColumns Instance: ExcelInstance
Excel.SaveExcel.SaveAs Instance: ExcelInstance DocumentFormat: Excel.ExcelFormat.FromExtension DocumentPath: $'''D:\\User\\wsanchez\\Course RPA\\Read From TXT Notepad\\%CurrentItem2%'''
Excel.CloseExcel.Close Instance: ExcelInstance
Variables.RemoveItemFromList.RemoveItemFromListByIndex ItemIndex: 0 List: FileContents2
EXIT LOOP
END
END
Also check the image at the end.
Please let me know if it works, happy automation!,
If I have addressed your inquiry successfully, kindly consider marking my response as the preferred solution. If you found my assistance helpful, a 'Thumbs Up' would be greatly appreciated.
Additionally, I offer specialized consultancy and development services leveraging PAD. If you're interested in exploring these services further, feel free to DM me, and we can initiate a discussion.
Kind regards,
Will SG
Managing Director & Automation Lead
RAMS CR (Recruitment & Automation)
LinkedIn Profile
