Trying to loop through every excel file and then rename it using value in each excel file

Hi there, this is my first post, hope I don’t confuse everyone too much with my problem.

I am trying to iterate through each excel file in a folder, read a cell value from an excel file and then rename that workbook using that value.

So far I have.
Assign: Variable1 using System.IO.Directory.GetFiles(PathVariable)
ForEach file in Variable1
Set Excel Application Scope to file
Read Cell and Set Variable2
Assign Variable3 = left(Variable2, 5) since i only need the first 5 characters
and then rename file by using
Move From: PathVariable To: Variable3

I’m running out of ideas to attempt. Hope you awesome bot-makers can assist.



@SamLong - You are on the right track. On the last step you mentioned:

The PathVariable will contain the complete path of the file, so I would look for the string after the last backslash in this PathVariable and then use the below function to rename the file.

FileSystem.RenameFile(filenamefrom-PathVariable, Variable3)


Hey @SamLong still need help with this? Just finished putting together a workflow that does this, with a few tweaks. I needed the first sheet name, which always changes so I pull all workbook sheets to an array and access the first one, to then be able to read the cell value. The renaming process then is a move file activity, with the Destination as the new file path + new file name with an extension as ending.