cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
visheshjain
Frequent Visitor

Rename Files based on Excel

Hello everyone,

 

I am using Power Automate Desktop to try to rename files based on data from excel and here is my excel table.

NameExtensionDate accessedDate modifiedDate createdFolder PathFinal Name

Croco Child.jpg.jpg02-07-2022 17:38:3429-07-2015 20:31:2002-07-2022 17:38:34C:\Users\win\Desktop\Photos\Crocodile_29-07-2015 20:31:20
Midway Horse.jpg.jpg02-07-2022 17:38:3424-02-2014 01:35:5302-07-2022 17:38:34C:\Users\win\Desktop\Photos\Horse_24-02-2014 01:35:53

 

The first column(Name) is the current file name and the last column name (Final Name) is the name that I want to give to the files.

 

For some reason the flow is not taking the column names of the excel file and giving errors.

 

Screenshot (354).png

I the flow variable I am able to see the column names and yet the flow is not able to recognize the column names.

Screenshot (355).png

 

Please can someone help me out as I am trying to make the whole thing dynamic based on the data in excel, by creating 'For each' loops.

 

Thank you,

 

Vishesh Jain

1 ACCEPTED SOLUTION

Accepted Solutions
Ankesh_49
Super User
Super User

@visheshjain 

Issue here is with the file name refer below:

https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

 

Ankesh_49_0-1656951146505.png

Ankesh_49_2-1656951706194.png

 

Therefore, either you change the filename or use replace text at runtime to remove ':'

Ankesh_49_1-1656951328403.png

 

Hope it helps!!

 

Cheers,

Ankesh

--------------------------------

If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

 

View solution in original post

11 REPLIES 11
jaeiow
Advocate II
Advocate II

Hi @jaeiow,

 

I am trying to do this on Power Automate Desktop and the solution you mentioned requires using the online flows.

 

For reasons unknown PAD is not able to recognize columns from the excel even after the read excel function is giving me the desired table.

 

Thank you,

 

Vishesh Jain

visheshjain
Frequent Visitor

Hello,

 

I've tried multiple methods and for some reason I am getting the following error:

Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Can't rename file ---> System.NotSupportedException: The given path's format is not supported.
at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)
at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.RenameFilesAction.Execute(ActionContext context)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.RenameFilesAction.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

 

It is unable to recogniize or get the file path but when I copy paste the same file path in the windows explorer, it opens up the file immediately.

 

When I put a Display message action to display the output of the flow variable, it shows me the correct path.

 

Please is someone can help me.

 

Thank you,

 

Vishesh Jain

Ankesh_49
Super User
Super User

@visheshjain Please check your action 'Read from Excel Worksheet' if you have enabled below:

Ankesh_49_0-1656928370015.png

Ankesh_49_3-1656928624717.png

 

 

Ankesh_49_2-1656928555977.png

 

Ankesh_49_1-1656928532775.png

 

Hope it helps!!

 

Cheers,

Ankesh

--------------------------------

If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

Hi @Ankesh_49,

 

Yes I have enable the first rows as header.

 

I tried the same thing and I am now getting the correct FilePath when I use the Display Message.

 

However, when I try to use that same path in order to get the file to rename, I get an error.

 

If you'd like any further information then please let me know.

 

Thank you,

 

Vishesh Jain

Ankesh_49
Super User
Super User

What are the steps you are performing here in the highlighted part:

Ankesh_49_0-1656937059910.png

Would you mind sharing a screenshot?

Hi @Ankesh_49,

 

Thanks for taking the time to respond.

 

Here are my steps.

 

As you can see, the flow works fine and it displays the right message.

 

It is only in step 7 when I actually try to rename the files it gives an error.

 

Hope this helps you understand the problem better.

 

Screenshot (357).png

 

Thank you,

 

Vishesh Jain

Ankesh_49
Super User
Super User

Could you please share Rename file action screenshot. I believe its something to do with date time format in the filename or the path

Here is the Rename Files step and as you can see in the 2nd screenshot I am getting the message in the display.

 

The new names have been defined in the excel sheet itself and have been converted to the format text.

 

Screenshot (358).pngScreenshot (359).png

Screenshot (360).png

 

Thank you,

 

Vishesh Jain

Ankesh_49
Super User
Super User

@visheshjain 

Issue here is with the file name refer below:

https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

 

Ankesh_49_0-1656951146505.png

Ankesh_49_2-1656951706194.png

 

Therefore, either you change the filename or use replace text at runtime to remove ':'

Ankesh_49_1-1656951328403.png

 

Hope it helps!!

 

Cheers,

Ankesh

--------------------------------

If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

 

Hi @Ankesh_49,

 

I would have not wasted 3 days had I realized how minute the error was.

 

Thanks for pointing it out.

 

Vishesh Jain

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,599)