Please help me with the following scenario, as I am unable to find proper solution to it.
I have below type of files to map:
a) CSV File : It has lots of columns and rows
b) Excel File : This is a standard file template with columns (columns name are different from column names in CSV file)
Now for a specific condition - if column (Case_ID_ Count) in CSV file has data as 1, i need to map data from specific columns in CSV file to specific columns in Excel File as below:
What I have done uptil now:
Step 1: Used Read CSV activity to read data from csv file and converted it into datatable - lets say DT1
Step 2: Used Read Range to read Excel file into datable - lets say DT2
Step 3: Used “For Each” rows in DT1 and inside For each loop used “If Activity” with condition as - row(“Case_ID_ Count”).ToString.Contains(“1”)
Now I am stuck as i am not sure how to map the data…Please help as I am pretty new in Uipath Or Development
to be more specific:
Split your data table in two tables. one with the flag Case_ID_ Count == 1 and the remaining entries.
Join or replace your values in the first table.
At the end merge both tables back together.
(from x In dtPeriod.AsEnumerable() where (From a In dtPeriod.AsEnumerable() Join b In dt_calandar_datatable1.AsEnumerable() On a(“column3”).ToString Equals b(“Date”).ToString select a).Contains(x) select x).CopyToDataTable()
Just guessing: the DataTable for Write Range is empty.
I think the join command is wrong. You have to set in the join only the matching columns (e.g. a personal number which exist in both tables and combines both tables). Like NSLookup in Excel. And then you can remove the old columns and rename the freshly joined columns.
Step 1 - Filtered Data in source file as per condition using Filter Data Table activity
Step 2 - Renamed Column name of filtered DT as per Excel Template Column Name using Assign activity (Datatable.Columns(“Old Column Name”).ColumnName = “New Column Name”
Step 3 - Write the data table with renamed column name into excel file 3
Step 4 - Used Merged Data Table Activity to Merge Excel File 3 and Original Excel Template
Step 6 - Used Join activity to get Location code based on City column in Template