Skip to main content
Question

Loop through columns and dynamically get column number

  • February 23, 2023
  • 6 replies
  • 1177 views

Forum|alt.badge.img+5

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

Padmakumar
Premier Pathfinder | Tier 7
Forum|alt.badge.img+15
  • Premier Pathfinder | Tier 7
  • February 23, 2023

Hi @Kasia 8214 ,

 

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


Forum|alt.badge.img+5
  • Author
  • Cadet | Tier 2
  • February 23, 2023

Hi @Padmakumar,

 

only specific column - column named with yesterday’s date

 

thanks!


Padmakumar
Premier Pathfinder | Tier 7
Forum|alt.badge.img+15
  • Premier Pathfinder | Tier 7
  • February 23, 2023

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.

 


Forum|alt.badge.img+5
  • Author
  • Cadet | Tier 2
  • February 23, 2023

My bad! Apologies, yesterday date :) 


Forum|alt.badge.img+5
  • Author
  • Cadet | Tier 2
  • February 23, 2023

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 


Padmakumar
Premier Pathfinder | Tier 7
Forum|alt.badge.img+15
  • Premier Pathfinder | Tier 7
  • February 23, 2023

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.