How to Extract Data from Multiple Web Pages into Excel

The dataset we will use has two columns called Year and URL, which link to articles of top movies for the respective year. We will use those URLs to extract data from multiple web pages into Excel.

dataset to extract data from multiple web pages into excel


Step 1 – Connect to the Web

  • Select the C5 cell and copy the URL.

Connecting to web to extract data from multiple web pages into excel

  • Go to the Data tab in your toolbar.
  • Select the From Web option.

Connecting to web to extract data from multiple web pages into excel

  • A window will show up.
  • Paste the copied URL and press OK.

Connecting to web to extract data from multiple web pages into excel


Step 2 – Open the Power Query Editor

  • When the Navigator tab is opened, you can preview the table on the right side of the tab.
  • Click on the Transform Data option.

Open the Power query to extract data from multiple web pages into excel

  • In the Query Settings bar, select the Name option.

Open the Power query to extract data from multiple web pages into excel

  • Change the name to Movies.

Open the Power query to extract data from multiple web pages into excel

  • Go to the Home tab and select the Close and Load option.
  • From the drop-down menu, select the Close and Load To option.

Open the Power query to extract data from multiple web pages into excel

  • A window will pop up.
  • Select the Existing worksheet option.
  • Press OK.

Open the Power query to extract data from multiple web pages into excel

  • Excel will show the data table in the column.

Open the Power query to extract data from multiple web pages into excel


Step 3 – Edit the Query Using the Advanced Editor

  • From the Queries and Connections bar, select the Movies1 option and right-click on it.
  • Select the Edit option.

Edit query to extract data from multiple web pages into excel

  • Select the Advanced Editor option.

Edit query to extract data from multiple web pages into excel

  • You will find the following window.

Edit query to extract data from multiple web pages into excel

  • Replace the code with the following code and click on Done.
(URL) as table =>
let
Source = Web.Page(Web.Contents(URL)),
Data1 = Source{1}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data1,{{"Header", type text}, {"Weight class", type text}, {"", type text}, {"2", type text}, {"3", type text}, {"Method", type text}, {"Round", Int64.Type}, {"Time", type time}, {"Notes", type text}})
in
#"Changed Type"

Edit query to extract data from multiple web pages into excel

  • The following window will appear. We will let the window remain the same.

Edit query to extract data from multiple web pages into excel

  • Change the name of the function to fxMovies1.

Edit query to extract data from multiple web pages into excel

  • Click on the Close and Load option.

Edit query to extract data from multiple web pages into excel

  • You will now find the function fxMovies1.

Edit query to extract data from multiple web pages into excel


Step 4 – Add a Custom Column

  • Select any of the cells of the cell.
  • Go to the Data tab and, under the Get and Transform Data option, select the From Table or Range option.

  • Excel will show the following table.

  • Go to the Add Column option.
  • Select the Custom Column option.

  • A window will show up.
  • Change the new column name to FetchMovies.
  • Use the following custom column formula.
=fxMovies1([URL])
  • Press OK.

  • A new window will show up. Select the Continue button.

  • In the Privacy Levels window, select the option shown in the image and save.

  • Excel will show the following table. Click the icon on the top-right next to FetchMovies.


Step 5 – Remove the Prefixes from Extracted Data

  • Uncheck the option for the prefix.
  • Press the OK option.

  • Excel will show the following table in a preview.

  • In the Home tab, select the Close and Load option.


Step 6 – Final Result

  • You will see all the movie names. Here’s a segment of the table.


Download the Practice Workbook


Get FREE Advanced Excel Exercises with Solutions!
Souptik Roy
Souptik Roy

Souptik Roy, a BSc graduate in Naval Architecture and Marine Engineering from Bangladesh University of Engineering and Technology, dedicated 1.5 years to the ExcelDemy project. During this time, he authored 50+ articles and reviewed 20+ for ExcelDemy. Presently, he is a designer and content developer at YouHaveGotThisMath and Brainor, sister concerns of ExcelDemy. His educational content spans science, mathematics, and grammar. Roy's interests include developing creative ideas, visualizing concepts with tools like Adobe Illustrator, and problem-solving within Microsoft... Read Full Bio

2 Comments
  1. before Step 5, excel is showing this “please specify how to connect- edit credentials”

    • Dear KUNAR,

      Thank you for your comment. It seems that you are encountering an issue with the “Edit Credentials” prompt in Excel. This prompt usually appears when there is a need to specify the connection details or credentials for accessing external data sources. Make sure you have marked the box in the Privacy Levels window.

      If you are still experiencing issues or have any further questions, please let me know, and I’ll be happy to assist you further.

      Best regards

      Al Ikram Amit

      Team ExcelDemy

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo