I have 500 files I need to rename. currently the files are named by Client ID.SubID but I need them to be named by company names.
I have a CSV file that has the ClientID.SubID (ie., Company.001) and list the company name next to it (ABC Company). I have 500 files in explorer that I want to check against the csv file, find the correct client Id and rename the file with the corresponding file name. Can this be done in uipath? if so HOW?
I have tried the Move file activity but I am not sure on how to get my output name from the Csv file to be copied and then pasted as the new file name. i have seen a lot of post on how to rename and trim or manipulate a current file name but how can I cut and paste a name from a n excel spreadsheet or scraped date to make it the new file name?
I suggest you to join our Uipath Academy and take the Foundation Course to understand Uipathâs World. Itâs free and you also can obtain a Certificate
But, anyway jeje let me try to guide you in order to build your solution.
Read Range: Use to read the Excel file and store all the data from your CSV that has ClientID.SubID on a DataTable variable.
UiPath.Excel.Activities.ExcelReadRange Reads the value of an Excel range and stores it in a DataTable variable. If the range isnât specified, the whole spreadsheet is read. If the range is specified as a cell, the whole spreadsheet starting fromâŚ
For Each Row: Use to iterate through all the rows from the DataTable generated in the read range activity in order to get ClientID.SubID by row
UiPath.Core.Activities.ForEachRow Executes an action once for each row in the DataTable provided. # Properties ## Input * DataTable - The DataTable variable for which an action is to be executed once for each row. ## Misc * Private âŚ
Inside Loop , use assign acitivity to populate a variable with the name of ClientID.SubID extracted from Excel, after that,
Use Path.GetFileName(âstring name from Row(âClientID.SubIDâ)â) in your for each loop like thisâŚ
As @DiegoTurati mentioned, these stuff are quite easier if you try out the foundation training in the academy
However I just thought of sharing a sample xaml file because I already have a similar one created for one of my own tasks. Just did some tweaks so that you can have a look on how it can be done easily. I have also added some comments in each activity so that you can understand the process easily.
Thank you for the file it is very helpful⌠One question⌠I am getting errors at the Assign stepâŚit says Cannot assign from type âSystem.Stringâ to type âSystem.Stringâ in Assign activity âAssignâ.
What does this mean? I have started the Academy but in a bind and really trying to figure this out.
The error says, it cannot assign a string to a string array. So why this error occur is because:
the command you have given under the value segment of the assign activity is surrounded by a double quotation. So though it has the command in it, it acts as a full string because of the double quotations
So change it as below: Directory.GetFiles("C:\Testing UIPATH\Centur Extensions\Released in ELF")