Hello Community,
When I run a flow in Power Automate Cloud with PAD it throws me the following error
Problem executing "ReadCSVWithCustomSeparator" action. Import failed. Failed to parse.
Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Import failed. Failed to parse. ---> System.IO.FileNotFoundException: Could not find file 'C:\.csv'.
at Microsoft.VisualBasic.FileIO.TextFieldParser.ValidatePath(String path)
at Microsoft.VisualBasic.FileIO.TextFieldParser.InitializeFromPath(String path, Encoding defaultEncoding, Boolean detectEncoding)
at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.ReadFromCSVFileAction.Execute(ActionContext context)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.ReadFromCSVFileAction.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)
My flow in the cloud with Unattended,
My flow in PAD run good,
How can I solve that?
I tried to find the file, but for some reason it doesn't download to the folder.
Now the situation or the problem I have, is how to download the file I need on the website with PAD and later in the flow of Power Automate Cloud, in the unattended mode.
In PAD I tried the option "Send Keys" 'Tab', but for some reason it doesn't work and with "Browser Automation" the options 'Press a button on the web page' and 'Click a link on a web page ' and it didn't work either.
How can I do it?
Visit this path and check whether a file with this exact name exists.
Path: C:\Users\fdogvg\Downloads\
File: RCV_COMPRA_REGISTRO_77578630-2_202210.csv
I tried with other options and now the complete path of the file appears, but it says the error that it does not find the file in the indicated path.
When I do the test in PAD everything works fine.
Problem executing "ReadCSVWithCustomSeparator" action. Import failed. Failed to parse.
Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Import failed. Failed to parse. ---> System.IO.FileNotFoundException: Could not find file 'C:\Users\fdogvg\Downloads\RCV_COMPRA_REGISTRO_77578630-2_202210.csv'.
at Microsoft.VisualBasic.FileIO.TextFieldParser.ValidatePath(String path)
at Microsoft.VisualBasic.FileIO.TextFieldParser.InitializeFromPath(String path, Encoding defaultEncoding, Boolean detectEncoding)
at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.ReadFromCSVFileAction.Execute(ActionContext context)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.ReadFromCSVFileAction.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)
In the first screenshot you had the extension but no filename.
In this screenshot only filename but no extension.
Attached screenshot of the message output. It returns the file path well and if it exists.
Regarding the Loop query, I have no problem removing "Get File Path", but will it change anything? and how can i do it? since before I have a File List and if I use [#] any number in PAD it will throw me fine, but in the Cloud it will throw me an error.
In the screenshot that you marked in red - Read from CSV is outside the loop
That is what I am referring to and responded to your reply.
That is where you need to put your display message and therefore asked Filenamenoextension is inside the loop, is it accessible outside the loop?
Its likely that there was no file present during that run, you can check that flow run, and see the input and output of that action at the time in the Cloud Portal of the Desktop Flow run.
Hi @VJR
Testing the message, I get the expected result.
With respect to getting "Filenanoextension" out of the loop, I did it like this since "Get files from a folder" throws me as a list of files and to get the path of the file outside the loop I will not be able to get it since the previous option is a list of file, since I downloaded that file from a web page.
How can I solve that?
So that notation should work, I believe the reason is because the %FileCSV% might have been empty at the time it ran. This will cause the Loop not to run at all so none of those variables get populated. You can test this by maybe using a Set Variable action just before the Read From CSV action, set the new variable value to %Directory.FullName%\%FileNameNoExtension%.csv and save it to a location outside the flow that way you can review it later.
You may also notice that you are using a For Each Loop and setting the values in Get Path Part, is this intended? You will always only end up with the last file only in that list before the Read From CSV action happens. If you want to reference the last File in the Files list, there are a few options:
In the Get Files in Folder action, click the Advanced section and you can sort by any property available, like the date created and select in Descending order, this will put the most recently created file at the top of the list, then you can reference %Files[0]% as that will always be the first file in the list.
You can possibly save some steps as well, %Files% is a List of Files Variable but %Files[0]% is a File variable, which means you could use just the Get Files in Folder then use something like %Files[0].Directory%\%Files[0].NameWithoutExtension%.csv. That example is a little redundant but I assume you are just testing things.
This seems like an attempt to convert a CSV to an Excel Spreadsheet. If you CSV uses a default delimiter, then you could simply open %File[0]% in the Launch Excel action as CSV is a supported file type, then Save it as *.xlsx with the Close Excel action. Like this:
Hope this helps, here are some recommendations for more variable manipulation options.
Variable manipulation and the % notation - Power Automate | Microsoft Learn
Variable data types - Power Automate | Microsoft Learn
Datatype properties - Power Automate | Microsoft Learn
Manage variables and the variables pane - Power Automate | Microsoft Learn