Please Help! I need to put info from a datatable to Excel based on the column names

Hello Friends,

I’m really in need of some help. Right now I’m working on a task where the robot takes flight dates and locations from an excel sheet and finds flight information on each(5 results for each location). Right now via data scraping I have the results however I’m having trouble putting the information correctly in the new DataTable.
Below is the new excel sheet I am trying to fill out. Does anybody know how to properly put in the new information according to the column name(Cost in Cost, Arrival Time in Arrival Time, etc.)? If there’s any question or I need to explain something better please let me know. Thank you in advance!

Hi

Hope the below steps would help you resolve this

  1. I assume that you have a excel template with table structure built already
    Use a read range activity and get that as a datatable variable named dt

  2. Now use a data extraction and get the output as a variable named Extractedtable

  3. Now to add the value from Extractedtable to dt use a For each row activity and pass Extractedtable as input

  4. Inside the loop use a ADD DATAROW activity
    In that activity pass the value to the final dt as array of values like this in Arrayrow property

{CurrentRow(“yourcolumnname-1”).ToString, CurrentRow(“yourcolumnname-2”).ToString,…}

Pass number of values which is equal to number of columns in your final dt datatable

For more details and example

https://docs.uipath.com/activities/docs/add-data-row

Cheers @jkbarrows11

Thank you so much @Palaniyappan for the response! I was able to add the “Cost” of the flights however it did not add it to the “Cost” column. Is there anyway you could help me getting it into the proper column please?

The answer is always the same for these type of processes.

  1. Read Range the sheet into a datatable
  2. Manipulate the data in the datatable until it’s how you want it
  3. Write Range to the sheet, or to a new file (and delete the old file)