In this article I’ll show how to display scraped web data in Power Apps. For this exercise we’ll use the Premier League Table from the BBC Sport website. You’ll see how straightforward it is to use Power Automate Desktop to perform the scraping and save the output to an Excel spreadsheet
The Approach
The approach will follow the guidelines outlined in my earlier post: Web Scraping with Power Automate. The large amount of data we are wanting to scrape and the relative infrequency in which the data is updated, directs us to pre-scrape the data so it is readily available for use when needed, rather than scraping-on-demand
Because the data structure is a HTML table and fairly simple to scrape, I will use Power Automate Desktop
The scraped data will be stored in a preformatted Table in an Excel Spreadsheet. The Table is necessary to provide a Data Source to be used in Power Apps
Power Automate Desktop
I will use the Web Recorder functionality in Power Automate Desktop to open a new instance of the Chrome Browser and define the data to scrape. This is the most complex aspect of the exercise, but the Web Recorder in Power Automate Desktop makes it really easy
Once the data to be scraped is defined, I’ll supplement the flow with manually defined Power Automate Desktop Actions to open the Excel Spreadsheet at the start of the flow, write the data to Excel and then close both Excel and Chrome
The combination of using the Web Recorder to define the data to be scraped, supplemented by manually created Actions to fine tune how the scraped data is manipulated and stored is a good approach to take in most scraping situations
Using Power Automate Desktop to Scrape the Data
First of all, open Power Automate Desktop and give your Flow a name
We’ll use the Web Recorder to capture the info we require from the BBC Sport website. Load https://bbc.co.uk/sport/football/tables and then run the Web Recorder (the 5th button of the 6 horizontal buttons in the central column)
Select your preferred Browser, making sure you have already installed the Power Automate plugin for your chosen brower. Click next
You’ll now see the Web Recorder dialogue box pop up. Select start recording and make sure the window containing the Premier League is active
Select the elements of data you want to scrape. You’ll know when you’ve got them as they’ll show in a red box with the <td> heading at the top left indicating they are part of a HTML table. Once you have them selected, right click and select: Extract element value > Text.
Rather than scrape every column, I’ve selected the most important 5 columns. Select the elements in the first row you want to capture and then the corresponding elements in the second row. Power Automate Desktop is smart enough to know that you are wanting to scrape the full table and the elements in the rest of the table rows will be highlighted. You’ll see in the Web Recorder dialogue box that the data being extracted is a 5-column table. Select finish
Complete the Structure of the Flow
You are then returned to Power Automate Desktop where you can see the 2 actions of ‘Launching new Chrome’ and ‘Extract data from web page’
Now created the Spreasheet to hold the Premier League table data. It is a simple Excel Table starting at cell A1 containing the 5 columns of data we are scraping and with 20 rows. Save the Spreadsheet to OneDrive
Back to Power Automate Desktop and add 4 more manual Actions. At the start of the Flow, add an action to ‘Launch Excel’ and load the newly created Spreadsheet. Toward the end of the Flow, add actions to close the web browser, write the variable containing the scraped data to the Spreadsheet and then to finally close Excel and save the Spreadsheet
Run the Flow
Now run the flow. If you want to automate the flow so it runs once or more a day then you have to do this from Power Automate Cloud using a Scheduled Flow that accesses your PC or laptop via the On-Premises Data Gateway. For more info on this, or other alternatives, see my earlier post: Web Scraping with Power Automate
Display Scraped Web Data in Power Apps
Now you have an Excel Data Source on OneDrive that can be used in Power Apps. Simply connect to the Data Source from Power Apps and load the data in to a Gallery. That’s all you need to do to display scraped web data in Power Apps. I have several posts on how to get the best from Galleries, so if you need any help with Galleries then just do a search in the menu at the top of this page