How to manipulate data from rows to columns?

Hi, I have scraped data from a web page. In extractdatatable it is positioned like this:

But I need to get it written to csv like this so that columnb rows should be the columns:

Hello @hemuli

Did you try to manage this while scraping the data ? If not possible, you do it with excel scope, read the data, store it in a variable, than write it in a csv as the way you want.

Hi, I don’t quite get your answer. Actually I’m reading the data from ExtractDataTable row by row. It gives a result for example:
myvariable1, myvariable2
myvariable1,myvariable2 in for each loop and saves it to tmpDT

Is it possible somehow to arrange it so that it goes
myvariable1,myvariable1
myvariable2,myvariable2?

I can always use AddDataColumn activity but there needs to be something like 30 AddDataColumns as one AddDataColumns adds only one data column and in the next time the loop hits the Add DataColumn activity it just overwrites the added datacolumn where I need to add one column more through every loop iteration.

Hi @mz3bel

I’m scraping data from http://stat.fi/tup/alue/kuntienavainluvut.html#/year=2019&active1=SSS&active2=049?year=2019&active1=SSS&active2=837

This is how it looks in the site:

And this is how its in the ExtractDataTable

What I need to achieve is to get the highlighted data from extract datatable to columns and the third data from every row to rows. I manage to store those to individual variables but not able to set the data to columns and rows.

Hi, I managed to do this. I found an activity for the task
https://go.uipath.com/component/data-manipulations#

  1. Scrapped the data from the web
  2. used Transpose activity from the tool and transposed the extracted data from ExtractDataTable
  3. Saved the Transposed data to new datatable variable
  4. Removed rows that I did’nt need
  5. Wrote to the csv

And the end result just as I needed it :slight_smile:

1 Like

Good to know that you solved your problem! Sorry was busy couldn’t check your request, best of luck!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.