Append column from one Datatable to Another

I have a excel file which contains some URLs. I used read range to go from excel to data table (DT1).

Then I setup a bot that visits each URL and scrapes one piece of data (a number). It then stores this into a new data table (DT2).

My question is how do I put the data from DT2 into DT1. I don’t want to append it into the same column. Rather I want to add a new column (at the end), and I want the rows to match up with the URL
Example 25 89

I hope this makes sense. If there is an easier way to do it other then the way I described I want to do it, please let me know.

Hi @Sami_Syed

Your provided links are not working for some reason. However this is what I understood from what you have described.

  1. You have a excel with a list of URLs. You extract the excel to a datatable.
  2. Then you loop through this datatable, Go to that website and scrape a number and stores it into another datatable. So, For each URL, you only have one number/ one row in the DT2 right?
  3. Now you need to get that DT2 data into DT1 as a new column. So since for each URL, you have only one row in DT2, it can be done easily…

Check out the below workflow. It is bit similar to your requirement. I created this to help one of the friends here in the forum too… It will work for you as well.

Note: This will only work if you have one row in DT2 for each URL you have in DT1
Let me know if this is not your requirement. Since the links you provided is not working for me, I am writing to you from what I understood from the description of yours.

MatchDataTables_CombineAsColumns.xaml (8.2 KB)

Those are just example urls.

Yes this is correct

I’ll checkout the workflow you sent and see if it works.

Its also worth mentioning that everytime the bot is run, there will be 1 new column added to the excel/DT1

which is why I said

Question. Why is there a DT called FinalMatchList, what is the purpose of this?
And also why did you put a loop within a loop?
which DT is valuefield1 located in?

I’m fine with just duplicating your workflow but I would also like ot understand how it works

Main.xaml (23.8 KB)

Please take a look at the flowchart.
URLTable is the one with the URLs and sessionTable is the one that gets one piece of data from web.

I need to add sessionTable as a new column into URLTable. Then put URLTable into an excel.
Let me know how I can do this, as I did not understand how your example works

Any updates?

Hey @Sami_Syed

I had missed the last few posts :frowning:

I did made some changes to the workflow you shared. I have also added some comments for those activities so that you can easily understand.

This will work for you…

Main.xaml (24.2 KB)

Let know if any queries on this…