How to get the individual row values of the matrix format and write into the excel sheet

activities
studio

#1

The following is the screenshot of the matrix format in the webpage ,

Capture4

And write that data into the excel sheet in the following format,

July 16, 2018, USD, GBP, 1.31593

July 16, 2018, GBP, USD, 0.75992

Thanks.


#2

Have you tried extracting as structured data and seeing what the datatable outputs?


#3

Hi Timk,

Am getting the whole table output as follows,
Capture6

Thanks.


#4

You could try using a for each row - (you know the currency country for each column)

You can build a new datatable with headers (Month / Day / Year / From Currency / To Currency / Rate) and add in the relevant information as you described

So for the first row - it would all be from USD to currency
E.g. USD to USD / USD to GBP / USD to CAS.
Second row GBP to USD / GBP to GBP and so on.

Then simply write that datatable to an excel file


#5

HI TimK, Thanks for the reply. Can you once explain this point you said,

You can build a new datatable with headers (Month / Day / Year / From Currency / To Currency / Rate) and add in the relevant information as you described.

And can you send me the code snippet for “for-each logic”, as I am new to this uipath.

Thanks.


#6

Hi,

I have built out the logic - this is very rough / high level. If you pass in your datatable as above it should produce an output in the format required.:grinning:

If you have any questions around the code, let me know.

Thanks,
Tim
Main.xaml (16.7 KB)


#7

Ok Timk, thanks.


#8

@TimK, Thanks for the xaml and can you once explain the first point,

“Data Table from Website activity” in the below screenshot.

Thanks in advance.


#9

Hi,

That was just example code (I built a datatable rather than scraping table from website) - it can be removed.

Thanks,

Tim


#10

Ya ok @TimK, thanks. Can you please explain the for each row logic in the code you have given.

Thanks,
Sushmitha.


#11

Hi,

The logic loops through each row pulled from the website table(one currency against all the other currencies) – it then adds a new row with all the relevant information for that currency

It then checks if the column it was just working is the same and increments the ‘to currency’ name.

After it has finished each of those it then increments the ‘From currency’ name

Hope that helps.


#12

Ya @TimK, add data row checks the conditions in the if loop!?


#13

it will always add rows for each cell - the If condition is checking if the currency it was updating is the same as the previous


#14

Ok @Timk, am using this in the Reframework. There am getting assigning the TransactionItem to Country List.

So upto the scrapping am able to run, getting error at the Assignment of CountryList. uploaded the xaml files, and getting error in Currency Exchange xaml. Can you please look into them.

GetTransactionData.xaml (12.0 KB)
Main.xaml (54.5 KB)
CurrencyExchange.xaml (24.6 KB)
Openwebsite.xaml (6.5 KB)
Closewebsite.xaml (5.6 KB)
This is the Config data sheet.
Config.xlsx (11.6 KB)