Search API Connector Documentation
Import Google PageSpeed Insights Data to Google Sheets
In this guide, we’ll walk through how to pull Google PageSpeed Insights data data directly into Google Sheets, using the API Connector add-on for Sheets.
PageSpeed Insights is Google's tool to measure and analyze the performance of a webpage. You may have seen data from this API when running a Lighthouse audit of your site, which retrieves PageSpeed Insights data and presents it in your browser console like this:
With this API, you can see this data in Sheets instead of (or in addition to) viewing the Lighthouse report in your browser.
- Before You Begin
- Part 1: Connect to the Google PageSpeed Insights API
- Part 2: Pull Data from Google PageSpeed Insights to Sheets
- Part 3: Create a Custom Request
- Part 4: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Connect to the Google PageSpeed Insights API
- In Sheets, open API Connector and create a new request (Extensions > API Connector > Open > Create request)
- Select Google Pagespeed from the drop-down list of applications
- Under Authorization, click Connect to Google Pagespeed
- You will be directed to google.com and asked to sign in.
- You'll then be returned to your Google Sheet, and can verify that your Google PageSpeed Insights connection is active.
Part 2: Pull Data from Google PageSpeed Insights to Sheets
Now that we’re connected, let’s pull some data into Sheets.
- Select the
/runPagespeed?fields=lighthouseResult/categories/*/scoreendpoint, which allows us to retrieve a summary of the audit scores reported by Lighthouse
- In the
urlparameter, enter your URL of interest. This can be any URL as all data processed by Lighthouse is public.
- Optionally populate other request parameters to customize your request. For this example, we'll select multiple categories.
- Choose a destination sheet, name your request, and hit Run. This API is pretty slow, so just hang on for a minute or two. When it finishes running, you'll see the response data in your sheet.
Part 3: Create a Custom Request
Alternatively, you can run your own custom requests instead of using API Connector’s pre-built integration, using any of the endpoints and parameters shown in the API documentation. Here's a sample request configuration:
- Request URL:
Part 4: API Documentation
Official API documentation: https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed
The documentation also contains a handy expression builder that you can use to create and test queries. You can then take the resulting cURL snippet and copy/paste it into API Connector (Extensions > API Connector > Import / Export > Import cURL). Just remove the Authorization header as we handle authorization through the OAuth2 connection manager.