Writing only one row from datatable to excel



Hi friends, i need your help. I have datatable with column “Name” and column “URL” and i want to write it to excel, but only the first row, what is the best way to write only first row?


Hi there @Michau_Alo,
There are a few ways to achieve this, but I believe the easiest is:

Assign - dtFirstRow = dtAllRows.Clone
Add Row - ArrayRow = dtAllRows.Rows(0).ItemArray - DataTable = dtFirstRow

From here, you can simply use your Excel Write Range activities with dtFirstRow, which will be a new DataTable, containing only the first Data Row of your original.

Thanks in advance,


Hi MR_JDavey Thank you for solution it worked great! I have one more question, what if i want to loop it and get first row every time i iterate through the datatable - dt and at the end when i have new datatable with all first values i’m gonna be able to write range to excel. Thanks in advance.


Hi there @Michau_Alo,
So you want to loop through your original DataTable (with all the data) and for every iteration, add the first Data Row values to a new DataTable.

So, your original DataTable would be:

Then, you want to loop through, getting the first Data Row values and adding those to a new DataTable, so you end up with:

Or am I misunderstanding?

Thanks once again,


Sorry, i will try to make it clear.

My script first read’s a value - “Name of product” from the googlesheet
(i’m using googlespreadsheet activities to connect wih the api)
Then it open browser perform actions and finaly scraps a column with price and and corresponding url but i’m using data scraping tool and i’m not able to get only first price tag and url so i get them all and i want to get first row witch includes price and url and write it to google excel sheet then process should repeat itself to the point it will go through all product names read from the excel sheet.

here is the xaml file, thank you very much for your help i really appreciate it.

forum.xaml (33.7 KB)