How to Write Range dynamically into next cell? A1>A2>A3

Yes ,you are getting 8 rows of data,

  1. everytime, the data is being scraped from the web
  2. We are getting the value of column index 1 in the extracted data and storing in a data column variable
  3. Passing that column to buildDataTable in add data column will add it automatically

Ok. So from Web Scrap I get 8 rows, I decided to use MessageBox to understand how much data is saved in DataTable (variable – buildData)

buildData.Rows.Count

It returned 1

Then I tried to export it into Excel by using WriteRange activity. It doesn’t work – Excel file is Empty, there is a Sheet1, but no data.

So the question is – if the data get scraped from web (8 rows), why it doesn’t get saved in DataTable (buildData)? That’s probably why WriteRange doesn’t work, because there is nothing to export?

Just a clear thing in the screenshot,
You build an empty datatable (builddataTable) , and get data from the web (ExtractedDataTable)

so, if you write ExtractedDataTable in the excel, it will write data, but you are not adding any data from the extracted data to empty data table. So, it won’t write any data.

ok. So, how to add data from ExtractDataTable to DataTable (buildData)?

here it is @nova001

ok.So I added Assign and Add Column activities…but it gives me error Assign: Cannot find column 0 (which means data has not been loaded from ExtractDataTable to DataTable (dataBuild))

What am I doing wrong?

That was my mistake :slight_smile:

Use this in the right hand side of assign activity

datatable.Columns.Item(0)

Or if you know the column name and if it same everytime, you can give it as

datatable.columns(“column name”)

ok.so if I do:

dataBuild.Columns.Item(0) - it gives me same error Assign: Cannot find column 0

if I do exactly like:

dataBuild.columns(“column name”) - it returns me Message Box saying 1 and Excel file is still empty!

wtf here

Share me the entire workflow, I will look into it

Thanks
Nova-DataScrap6 to check.xaml (12.6 KB)

While I reviewed your code, there is incorrect config for build datatable and then adding columns. Try correcting that as per your column needs. Code will work

I have no idea how to set right settings… can u be more specific please?

Also, extracted data table is used no where that’s why excel file is empty. You are using build table only and writing nothing into it.

yea, I thought that too… so how to do it correctly?

I need to build the process when I have list of URLs from Excel, so I need it to open browser > scrap data > save 8 rows of data vertically in A1,A2…A8, and next URL scrap data and save it next column in Excel B1,B2…B8.

But I don’t understand how to put scraped data to the DataTable dynamically in next next next column.

Nova-DataScrap6 to check.xaml (13.0 KB)

Try this. and if you want to limit the write cell, use a enum with three values in a for each loop.

Do something like, in write range, use a array and in that define A, B, C and count numbers so when the first time loop will run, it will take A, next time B etc

ok. Thank you. I ll try to understand your worlkflow.

CoulmnWiseScrape.xaml (13.4 KB) Result.xlsx (9.7 KB)

Try these, I have tried to solve your process flow, it extracts data table and then each time writes it into A, B, C columns. Hope it helps.