How to Add Column & Value into Existing Data Table

Hi All,

I’m trying do use Data Scraping and store the value into Excel, this step has been done.
But except store the whole data from Web, I need to add the column and store the value into ExtractDataTable and then store it into Excel. You may look for the example as below.

read0.xlsx (10.8 KB)
“Sheet1” is the original item I have.
“1312595682” is the result i got but not I want
“1312538855” is the result I got but not I want
“The Result I want(sample1)” is the sample result I want but unable to get this
“The Result I want(sample2)” is the sample result I want but unable to get this

Automate.7z (25.1 KB)
This is the sample i did.

Appreciate your help for this issue. Thanks

@ksrinu070184 Hi Bro, appreciate your help again for the issue =(

@ack940129

Can you share some more details like what the Sample1 and Sample 2?

I didn’t able to open your zip file as i don’t use 7z

Appreciate if you provide some screens

Thanks

Hi @ksrinu070184, I have also attached the excel file in the post, you may take a look, let me know if you need other documents. Thanks for your help!

@ack940129

You need to add the column OrderNo1 and add the data, Is it this you are looking for?

Thanks

@ksrinu070184, Yes you are right!

@ack940129

  1. After Read Range Activity place a Add Data Column Activity
  2. In Properties give the Name of the Column Name, Datatable which you output from Read Range Activity
  3. Use ForEach row and declare a variable for index
  4. Use Assign activity inside the For each row and write
    DT.Rows(index).Item("ColumnName") = Your Value

For more reference you can check below post
https://forum.uipath.com/t/tutorial-how-to-calculate-difference-between-two-time-values-using-uipath/247565/3

Hope this helps you

Thanks

Hi @ksrinu070184,
I can only get the 1st column as below. The rest of the column is not showing.

Also, I found that the second sheet is showing the same OrderNo as below.

Main.xaml (19.3 KB)
This is the code I have, you may take a look. Thanks

@ack940129

Add the project.json file also

Thanks

Hi @ksrinu070184

Here you go. Thanks.

project.json (934 Bytes)

@ack940129

Check below

You missed the foreach index, so it will always write in 0 only

Check as below

Index has to increment then you can change to different rows or else it is fixed
like
DT.Rows(1), DT.Rows(2) etc.,

Hope this helps you

Thanks

@ksrinu070184 Thanks for your reply, but I have received an error as below.
image

@ack940129

Can you check the extract datatable is returning data or not?

Can you place a output datatable activity and keep message box, so that you can view the data of the datatable

Thanks

@ksrinu070184
The message box show nothing but when I write range into the excel, the excel shown the whole extract datatable, that is strange, do you know why?

image

@ack940129

did you place the output datatable and declare a out variable?

After that place the messagebox and give the out variable in message box

If you did same share the screens

Thanks

@ksrinu070184, this is how i do, is there anything wrong about this?
image

@ack940129

You can’t give message box directly for Datatable

You have to place a output datatable activity and create a string variable in Output

then you have to give that string variable in messagebox

Thanks

@ksrinu070184

i see, you mean like below?

@ack940129

Yes, also place the assign activity and write range after the extraction of datatable

Once the datatable is ready then you can write to datatable with your values

Also check the sheet name you are writing with the row, this is in For Each Row, So the For Each row changes the sheet also changes, is it that you require?

Thanks

1 Like

@ksrinu070184

I’m still quite blur on it as still getting the error as below, can u show me the example using the file i given you?
image

Yes, this is what I want.