Write data_scraping data into excel one below other

Hi experts,

I am using data scraping and writing data to excelsheet. It has 2columns and the number of rows varies everytime. The column1 has to be considered as a header and column2 has to be considered as the information under header. I have attached the sample image for the reference.

When I am running for the first time I need to write both column1 and column2 in excelsheet. But when it runs for the second time I only need to write the column2
as row in the existing excelsheet.
I am not pretty sure of using build datatable here because the column1 values varies everytime. So, is there any way to use builddatatable with dynamic headers or any other solution for this scenario. Please let me know.

Thanks in advance,
Mahi

My output should look like this
image

Can someone please help me out with this, it’s bit urgent

Hi @Mahimahi ,

I think based on your requirement we have to go for transpose datatable method.

Once you transpose the two tables columns will convert into rows and after that you could use merge datatable to merge the tables and you can remove headers from the second datatable by using uncheck add data header in option.

For transpose datatable please use the below custom package. Please try and let us know. Thanks.

If you want to do the transpose with out using above custom package. Please refer the below link.

Hi @kirankumar.mahanthi1,

I’m able to do transpose of excel_data. Since am using data_scraping I dont know how exactly I can use merge data here.

  1. find children
  2. For each
  3. Datascraping
    and I need to save all data from screenscraping to same excel sheet. I need to omit headers from the second iteration and save to same excelsheet.
    Forum is not allowing me to attach my flow since am a newuser.
    Could you please share sample code for merge datatable. It will be of great help.

Thanks in advance,
Mahi

Hi @Mahimahi ,

We can combine two datatables with the below two activities.

  1. Append datatable activity used to append data into another datatable whose having same structure (columns are same)

  2. If we are not sure about structure we can go for merge datatable. In this activity to provide input and output should be two different datatable it will merge source datatable with the destination datatable.

In your work flow your cloning some datatable it is not needed mehe datatable will come into picture when you have two datatables extracted by using extracted datatable activity. I hope you understood. Thanks.

Hi @kirankumar.mahanthi1,

Sorry I didn’t understand what you meant,
In your work flow your cloning some datatable it is not needed mehe datatable will come into picture when you have two datatables extracted by using extracted datatable activity.

Hi @kirankumar.mahanthi1,

I have ‘n’ number of items to go n click n fetch data using data scraping.
I’ll be clicking on the same items twice. I have to save data from both iteration to same excel sheet (I have to skip the header in 2nd iteration).
I hope you are understanding my scenario.

Thank you,
Mahi

Hi @Mahimahi ,

I am sorry it was my mistake and I have posted my comments through my mobile it had some spelling mistakes.

Is it possible to share your sample work flow so that we would help you better. Thanks.

Hi @kirankumar.mahanthi1,

I am unable to attach the workflow here.

I have attached screenshot earlier pls check and I have also mentioned my steps earlier.

Hi,

Earlier you have shared your partial work flow which is very difficult for me to understand your 100% requirement so i have requested your full work flow so that i can modify and help you to resolve your issue. I understood you are unable to attach your workflow due to joined newly in the forum. thanks for your detailed screenshots below. i Understood your requirement now.

Please add the below steps to your workflow.

  1. Create counter and initialize to 1. Before Data scraping activity place one of condition to check if Counter = 1 then → don’t add any activity keep it empty and else → drag and drop clear data table activity and assign extract data table DT. it will help you to clear data table content in the extract data table DT for second run and further runs.

  2. After Data transpose activity use merge data table activity add source data table will be your extract data table and destination should be merged data table.

  3. Remove the write range activity inside loop and place the same activity in the outside of the loop and assign your merged DT as input data table so that once the loop ends it will write entire data into excel.

  4. After go back activity keep the Assign activity and increment your counter
    Counter = Counter+1 to increase counter for all the runs.

i hope you will get some help on the above steps to achieve your requirement. thanks.

Hi @kirankumar.mahanthi1,

I have made some changes in my actual flow and am able to do transpose without custom activity but here the data is overwriting on first 2rows when am running.
(I have invoked this flow inside foreach)
SAMPLE_TEST.xaml (25.4 KB)

when I run first time, 2rows will be written in excel.
when I run second time, only second row should be written from next blank row in excelsheet.
I am confused regarding mergedata here. could you pls check.
Thanks,
Mahi

Hi,

I am not sure we both are going on same page. Some of the activities i am not able to view since i am not able to resolve the namespace error for data manipulations. Based on my understanding i have created updated sample work flow. Please check and see if it helps your requirement. Sorry if i am not helping you much. thanks.

Updated.xaml (13.8 KB)

Hi,

Sorry but you have worked on a commented out sequence. I think you didnt check the complete sequence.

Hi,

Yeah. In my opinion the commented out work flow is good comparing to your recent workflow. Use custom activity to transpose and aquire some idea from my updated work flow. I am just sharing some help and logic on how to append data efficiently. Thanks.

Hi Guys,

@Jobin_Joy , @Robinnavinraj_S , @pravin_calvin

Some how myself and @Mahimahi meeting dead ends. I have already provided some suggestions. Could you guys have any suggestions on this requirement and throw some helping hands. Thanks.

1 Like