Output of my web scraping data is repeating twice

Hi there @Himanshu_Singh2,
I hope you are well.

Is it possible the data already exists within the Worksheet?
The activity is set to “Append”, which would cause it to re-add the data, as opposed to overwrite it.

Please let me know your thoughts.
Thanks once again for your continued support,
Josh

Hi Josh,
The Excel sheet was empty before scraping. And after scraping the required data is there but repeating itself and that also not in a orderly manner.

@Himanshu_Singh2 Can you explain the issue a bit brief

@Himanshu_Singh2 Can you try this

  • In Extract Table Data activity remove Excel.Sheet(Sheet2)… and provide Data table variable (DT)
  • In the next step, write range within the field of what to write pass this data table name DT. See how it goes
  • Uncheck Append

Hi there @Himanshu_Singh2,
Understood - How bizarre.

Are you able to evaluate something for me?
Can you:

  • Create a DataTable Variable (System.Data.DataTable)
  • Set that as the Output to your Extract Data Table
  • Set that as the “What to write” value for your Write DataTable to Excel

Repeat and see if that results in the same output.

May also be worth logging the content of that DataTable before writing, to evaluate what is being extracted - Via an Output DataTable activity. This will convert a DataTable to a String (Comma-Separated), which can be subsequently logged.

Let me know your thoughts.
Thanks once again for your support,
Josh

1 Like

The process is that I have created 2 Excel Sheets, In the first one there are Keywords which are the input and the second one is for output. My sequence is taking the keywords from first sheet and searching on a website then showing the output on second sheet. Now I am getting the required result but for every keyword there are 2 same outputs.

@Himanshu_Singh2 Follow the steps that I have posted above it would help

Okay Thankyou

Okay I will try this Josh

1 Like

I tried your suggestion but it didn’t work.

There were no changes

@Himanshu_Singh2 Can you share the screenshot of your code snippet or sample code that you have built





@Himanshu_Singh2 Did you uncheck the Append in the write data table to excel activity and try the bot process

Yes I did that, but then only the result for last keyword was displayed

@Himanshu_Singh2 I see there is some warning showing at Extract Table Data activity. can you share that message. I guess you can hover your mouse over there to know that warning message

Hi @Himanshu_Singh2 , Please use a DataTable variable inside the Extract Table Data activity. Then use that DataTable in “What to write” field in Write DataTable to Excel Activity.
Destination is correct. This will resolve your issue.

@Himanshu_Singh2 Please try to use a OutputData Table Activity and print the output in a message box before Write Datatable to Excel activity . This will help you to debug the issue easily.

I can see that you are datascraping inside a for each loop. So, can you please try to clear the datatable just after appending to excel?

Thanks!
Athira