Rebuild a data table

Hello guys! Basically, I have a workflow, where I take some data from a website and need to upload it to a SQL table, but the data that I take out of the webpage is a mess and needs to be structured.

The data looks like this:


The problem is, that Column “Data” values should be the column headers, not values of rows, and Data1 column values should be rows of the headers. How can I do that, so I would get the result needed?

(The data in the webpage looks like this:)

NOTE: The values of Data column can be different for other pages, for example - there might be other columns added to the ones that are in the photo or some may not be there

Hi @Povilas_Jonikas

Here You can extract as shown in the above image and you can convert the datatable into dictionary and get the values by using keys

Cheers!

1 Like

Thanks for the quick response @Dinesh_Guptil, but I actually have no clue about anything when it comes to dictionaries and working with them, because I never have worked with them. Is there any other way?

@Povilas_Jonikas
Dont Worry will help you with the syntax.

1 Like

Ok, so I made a dictionary out of the data table that I get. Whats next, how can I start making a fresh data table with specific column names and theyr values?

@Povilas_Jonikas

After Creating Dictionary variable

Dict = DT.AsEnumerable.ToDictionary(Of string,object)(Function(r) r(Column1).tostring,Function(a) a(column 2).tostring)

Dict(“Rida”).tostring gives the value as 267000 KM

1 Like

Ok, thanks :slight_smile: Will try and let you know how it turns out

@Povilas_Jonikas Okay
Cheers!