Skip to main content

Notifications

Power Automate - Power Automate Desktop
Unanswered

ERROR READ CSV

(0) ShareShare
ReportReport
Posted on by 288

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,

fgonzalez515_0-1666402465730.png

 

My flow in PAD run good,

fgonzalez515_1-1666402962946.png

 

How can I solve that?

  • fgonzalez515 Profile Picture
    fgonzalez515 288 on at
    Re: ERROR READ CSV

    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?

  • VJR Profile Picture
    VJR 7,635 on at
    Re: ERROR READ CSV

    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

  • fgonzalez515 Profile Picture
    fgonzalez515 288 on at
    Re: ERROR READ CSV

    @VJR 

     

    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)

     

     

  • VJR Profile Picture
    VJR 7,635 on at
    Re: ERROR READ CSV

    In the first screenshot you had the extension but no filename.

    In this screenshot only filename but no extension.

  • fgonzalez515 Profile Picture
    fgonzalez515 288 on at
    Re: ERROR READ CSV

    @VJR 

     

    Attached screenshot of the message output. It returns the file path well and if it exists.

    20221022_010605.jpg

    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.

  • fgonzalez515 Profile Picture
    fgonzalez515 288 on at
    Re: ERROR READ CSV

    Hi @Jamar_Forsythe 

     

    I couldn't open direct CSV file in "Launch Excel".

    20221022_005235.jpg

  • VJR Profile Picture
    VJR 7,635 on at
    Re: ERROR READ CSV

    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?

  • Re: ERROR READ CSV

    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.

  • fgonzalez515 Profile Picture
    fgonzalez515 288 on at
    Re: ERROR READ CSV

    Hi @VJR 

     

    Testing the message, I get the expected result.

    20221022_001019.jpg

     

    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?

  • Re: ERROR READ CSV

    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.

    Jamar_Forsythe_1-1666407818613.png


    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:

    Jamar_Forsythe_0-1666407599075.png

    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

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard