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

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Connect to the Google PageSpeed Insights API

The easiest way to get started with the Google Calendar API is through API Connector’s built-in integration.

  1. Select Google Pagespeed from the drop-down list of applications
  2. Under Authorization, click Connect to Google Pagespeed
  3. You will be directed to and asked to sign in.
  4. 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.

  1. Select the /runPagespeed?fields=lighthouseResult/categories/*/score endpoint, which allows us to retrieve a summary of the audit scores reported by Lighthouse
  2. In the url parameter, enter your URL of interest. This can be any URL as all data processed by Lighthouse is public.
  3. Optionally populate other request parameters to customize your request. For this example, we’ll select multiple categories.
  4. 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. To create a custom request, add the complete URL into the Request URL field, choose Google Pagespeed from the OAuth menu, and enter a header where Key = Accept, Value = application/json.

To convert from a preset request to a custom API URL, tick the Add request URL box before running your preset request (under Output options). This will print out your complete API URL, which you can then copy/paste into the request URL field.

Part 4: API Documentation

Official API documentation:

Expression builder
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.

Previous Import Google Drive Data to Google Sheets
Next Import Google Search Console Data to Sheets

Leave a Comment

Table of Contents