Question

Loop through columns and dynamically get column number

  • 23 February 2023
  • 6 replies
  • 751 views

Badge +3

Hi Team! 

for my current robot I need to get data table from the website (this is the website: https://www.bnr.ro/Exchange-rates-1224.aspx) and extract values from column where column name is yesterday’s day. It will not be a fixed column number or column name. 

 

I was wondering if you have any best practices how to extract data from data table where column name is a variable?

 

Many thanks for helping! 


6 replies

Userlevel 7
Badge +13

Hi @Kasia 8214 ,

 

Do you need to extract data from all available column or from any specific one?

Badge +3

Hi @Padmakumar,

 

only specific column - column named with yesterday’s date

 

thanks!

Userlevel 7
Badge +13

Hi @Padmakumar,

 

only specific column - column named with today date

 

thanks!

 

If it is coming like this all the time, then you can go with the Index number right? Means, last column will always going to be the previous day data.

 

Badge +3

My bad! Apologies, yesterday date :) 

Badge +3

Hi @Padmakumar 

I find it a bit risky to take last column, for example if my bot gets delayed because of queue of robots in production and new set of data will be already published on the page, I want to take data from the correct column 

Userlevel 7
Badge +13

Hi @Padmakumar 

I find it a bit risky to take last column, for example if my bot gets delayed because of queue of robots in production and new set of data will be already published on the page, I want to take data from the correct column 

Hi @Padmakumar 

I find it a bit risky to take last column, for example if my bot gets delayed because of queue of robots in production and new set of data will be already published on the page, I want to take data from the correct column 

 

You can extract the table and save the data into an excel file. Later using Database action and SELECT query, look for the column with previous day date (Before this, you should assign a variable and save the previous day date with the same format which is available in the portal) and extract the exchange rates from it.

Reply