Rename excel

Hi…
I want to rename excel file downloaded from a browser in a loop…I don’t know the name of the file that will be downloaded and want to rename it to a specific number that I want it to read from an excel file.

Hi @Kajal_Sharma

Have a look to the below thread :-

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

VB.net…? Will this work in uipath also ?

Hi @Kajal_Sharma

Yes. Why not. While Selecting project we select language from 2 languages i.e., VB.Net or C#.Net so depending on that use the respective syntax.

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

@Pratik_Wavhal I dont want any date or anything…instead I want to rename it according to the other excel file

Hi @Kajal_Sharma,

This is for your reference

Regards,
Aditya

Hi @Kajal_Sharma,
I am also curious to know how you are downloading that file is this automatically downloads? or
it will ask for any prompt to save?
Regards,
Aditya

Hi @Kajal_Sharma

I thought depending on latest downloaded file of which you dont know the name you have to rename it so gave you above link. :sweat_smile:
My mistake i didn’t get the que properly

Then if you have to just rename then have a look to the below thread for the same :-

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hey @Kajal_Sharma,

Here you go use these commands to get the last modified file from directory.
String.Join(“”,Directory.GetFiles(our_FolderPath,”*”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1) )

Note:
1.Replace our_FolderPath with your desired folder path
2.Replace “” with your required file format “.xlxs”,”*.pdf”

Then you can use rename method to change the name using invoke method.

Mark this as solution if this helps.

Happy Automation!

Regards,
Aditya

Rename_A_File.xaml (5.1 KB)

image

In invoke method, Target type is : Microsoft.VisualBasic.FileSystem