Scrape data in seconds

No proxies needed

Start Free
Web Scraping

PageSpeed Insights to Google Sheets: Script and No-Code Routes

Two ways to get PageSpeed Insights results into Google Sheets: an Apps Script on Google's API with a weekly trigger, or a no-code export you import.

VK
Varun Kumar
··11 min read
PageSpeed Insights to Google Sheets: Script and No-Code Routes: Pulldata blog cover

💡 Key Takeaways:

1) Google Sheets can't call the PageSpeed Insights API with a formula, but a short Apps Script can: it reads a list of URLs, calls the API once per URL and writes one row of results per test.

2) Keep the API key in Script Properties, never in a cell, because anyone who can open the sheet can read its cells.

3) Apps Script stops a single run at 6 minutes and caps URL Fetch calls per day, so long URL lists need batches and a time-driven trigger.

4) The no-code route skips the script: run the audit in a web data tool, export the results and import the file into Sheets.

Put every page's speed in one sheet

Pulldata is a no-code web data platform that collects live, structured data from the public web. Its website speed audit for URL lists returns one row of PageSpeed results per page, ready to export to a spreadsheet, and you pay only for results that come back.

A Google Sheet Results tab with one row per URL per run, two weekly runs bracketed and LCP cells coloured by speed

What will you build?

You'll build a Google Sheet with a URLs tab and a Results tab, where each run adds one dated row of PageSpeed results per URL. Run it by hand or on a schedule, and the sheet becomes a running record of page speed.

The flow is short. The sheet holds the list, Apps Script sends each URL to the PageSpeed Insights API, and the script writes the values it gets back as a new row.

A URLs tab feeds an Apps Script editor calling UrlFetchApp with a Monday trigger, which writes rows to the Results tab

The PageSpeed Insights API returns the same report as the web tool, as JSON. If you'd rather not write any code, the no-code route further down gets the same rows into Sheets from an export.

Which route fits: a script or a no-code export?

A script fits if you're comfortable pasting code and want the sheet to refresh itself. A no-code export fits if you test a list now and then and want the rows without touching code.

Route

What you do

Best for

Pulldata no-code export

Run the audit on a URL list, export, import into Sheets

Occasional checks, no code, no Google key

Pulldata API from Apps Script

Call the PageSpeed audit API from the script

Scheduled runs without a Cloud project

Apps Script on Google's API

Call runPagespeed with your own key

Free scheduled runs within your quota

Manual web tool

Test pages at pagespeed.web.dev and copy values

Five pages or fewer, once

The steps below cover the no-code export first, then the script on Google's API, since that one has a documented request you can copy today.

The Sheets Extensions menu: add-ons for no-code export, or Apps Script with your own Google key or the Pulldata API

What do you need before you start?

You need a Google account and about twenty minutes. The script route also needs a PageSpeed API key; the no-code route needs a free Pulldata account.

  • A Google Sheet you own, with editing rights.
  • A clean list of full URLs, including https://.
  • A decision on device: mobile first, desktop if it matters to you.
  • For the script: a PageSpeed API key, restricted to the PageSpeed Insights API.
  • For the no-code route: an account at app.pulldata.io/signup.
Worth knowing

Each URL and device is one test. A list of 50 URLs on mobile and desktop is 100 calls, so plan run time and quota for the doubled count from the start.

The no-code route: Pulldata results into Sheets

This route uses Pulldata's website performance audit tool and a CSV import. The sign-up screen below is real, and the tool steps are written generically until fresh captures are added.

Step #1: Create a free account

Go to the Pulldata sign-up page and choose Continue with Google, or enter an email and a password of at least 8 characters, then click Create account. The page says new accounts get $10 free credit with no card required.

Pulldata create your account page with Continue with Google, email and password fields and a Create account button
The public sign-up page at app.pulldata.io/signup.

Step #2: Run the audit on your URL list

Open No-Code Tools, pick the website performance audit tool and paste your URL list. Run a test batch of five URLs first, then the full list.

Step #3: Bring the export into Sheets

Export the finished run and open your sheet. In Sheets, choose File, then Import, upload the file and pick "Insert new sheet" or "Append to current sheet" so older runs stay in place.

Name each import with the date and device. Our guide to a bulk PageSpeed test lists the columns worth keeping and why the field data level matters.

One Results tab where each weekly run appends rows with a run date, above a tab bar with Sheet7 and copy tabs struck out
Tip

Append every import to one Results tab and add a run date column if the export doesn't have one. One long tab is easy to chart and filter; ten tabs called "Sheet7" are not.

Developers who want scheduled runs without a Cloud project can call the PageSpeed audit API from Apps Script instead of Google's endpoint. Follow the request format on that page and the general setup in the Pulldata docs.

Step-by-step: PageSpeed Insights to Google Sheets with Apps Script

This route calls Google's documented runPagespeed endpoint from a script bound to your sheet. It's free within your project's quota and takes about fifteen minutes the first time.

Step #1: Set up the two tabs

Create a tab called URLs with a header in A1 and one URL per row from A2 down. Create a second tab called Results with these headers in row 1: Date, URL, Device, Performance score, Field LCP (ms), Field INP (ms), Field CLS, Field data for.

Step #2: Store your API key in Script Properties

Open Extensions, then Apps Script. In the editor, go to Project Settings, add a script property called PSI_API_KEY and paste your key as the value.

Script properties are a store that every user of the script can read, but only within that script (Apps Script Properties Service). Keep the sheet's sharing tight, since editors can open the script.

An API key typed in cell B2 shows in the formula bar to anyone who can view, while script properties keep it locked

Step #3: Paste the script

Replace the default code in Code.gs with this function. It reads the URL list, calls the API once per URL on mobile, and appends one row per result:

javascript
function runPageSpeed() {
  const key = PropertiesService.getScriptProperties().getProperty('PSI_API_KEY');
  const ss = SpreadsheetApp.getActive();
  const urls = ss.getSheetByName('URLs').getRange('A2:A').getValues().flat().filter(String);
  const out = ss.getSheetByName('Results');
  const rows = [];

  urls.forEach(function (url) {
    const api = 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed'
      + '?url=' + encodeURIComponent(url) + '&strategy=mobile&key=' + key;
    const res = UrlFetchApp.fetch(api, { muteHttpExceptions: true });

    if (res.getResponseCode() !== 200) {
      rows.push([new Date(), url, 'mobile', 'error ' + res.getResponseCode(), '', '', '', '']);
      return;
    }

    const data = JSON.parse(res.getContentText());
    const exp = data.loadingExperience || {};
    const m = exp.metrics || {};
    const p75 = function (name) { return m[name] ? m[name].percentile : ''; };

    rows.push([
      new Date(), url, 'mobile',
      Math.round(data.lighthouseResult.categories.performance.score * 100),
      p75('LARGEST_CONTENTFUL_PAINT_MS'),
      p75('INTERACTION_TO_NEXT_PAINT'),
      p75('CUMULATIVE_LAYOUT_SHIFT_SCORE'),
      exp.origin_fallback ? 'origin' : (exp.id ? 'URL' : 'no field data')
    ]);
    Utilities.sleep(1000);
  });

  if (rows.length) {
    out.getRange(out.getLastRow() + 1, 1, rows.length, rows[0].length).setValues(rows);
  }
}

Setting muteHttpExceptions to true makes a failed call return its response instead of throwing, which is what lets the script log an error row and move on (UrlFetchApp reference). The one-second pause keeps calls from bunching up.

With muteHttpExceptions set to true, a failing /blog URL becomes an HTTP 500 row and the remaining URLs still get tested

Step #4: Authorise and run it once

Click Run with runPageSpeed selected. Google asks you to authorise access to your spreadsheet and to external services; accept, and the run starts.

Each URL takes several seconds, because every call loads the page in full. Start with three or four URLs so the first run finishes quickly.

Step #5: Check the columns against a real response

Open the Results tab and look at the new rows. If a field column is empty for a busy page, add Logger.log(Object.keys(m)) inside the loop, run again, and compare the metric names in the log with the ones in the script.

The API's response holds a loadingExperience object with field metrics and an origin_fallback flag for pages that fell back to origin data (PageSpeed API schema). That flag is what fills the last column, so you can see at a glance which rows share the site-wide numbers.

PageSpeed JSON paths for LCP, INP, CLS, origin_fallback and performance score each linked to a row of sheet columns

Step #6: Switch device or add desktop

To test desktop, change both mobile values in the script to desktop. To test both, wrap the fetch in a loop over the two values, and expect the run to take twice as long.

Google's runpagespeed reference lists the other parameters, such as category for Accessibility or SEO results. Our mobile speed test guide explains why the two devices score differently.

Step #7: Schedule it with a trigger

In the Apps Script editor, open Triggers, add a trigger for runPageSpeed, choose a time-driven source and pick a weekly or daily timer. Minute timers accept only 1, 5, 10, 15 or 30 minutes (ClockTriggerBuilder), which is far more often than speed checks need.

Keep in mind

A trigger runs as the person who created it, using their quota and authorisation. If that person leaves the team or loses access, the weekly run stops without warning, so create it from an account that will stay.

Step #8: Split long lists into batches

Apps Script stops a single execution at 6 minutes and caps URL Fetch calls at 20,000 a day for consumer accounts and 100,000 for Workspace (Apps Script quotas). At several seconds per PageSpeed call, the time limit is the one you'll hit first.

An Apps Script executions list of three runs under the 6 minute cap, with NEXT_ROW saved as a script property between

For a long list, store the next row number in a script property, process a batch per run, and let a short timer pick up where the last run stopped. Once the list grows past what a sheet handles comfortably, the Core Web Vitals monitoring guide covers moving the routine out of Sheets.

How do you test it?

You test it by running the script on a short list where you already know the answer. Pick three URLs: one busy page, one low-traffic page and one that redirects or returns an error.

  • The busy page should show field values and "URL" in the last column.
  • The low-traffic page should show "origin" or "no field data".
  • The broken URL should log an error row, not stop the script.
  • The Performance score should be close to what pagespeed.web.dev shows for the same page and device.
  • Executions in the Apps Script sidebar should show a completed run.
A test sheet of three URLs: a busy page expects URL field data, a low-traffic page origin data, a broken link an error

Expect the score to differ a little from the web tool. Lab results vary between runs even with nothing changed, as Google's Lighthouse variability page explains, so a gap of a few points isn't a bug.

Quick check

CLS often comes back from the API as a whole number such as 5 or 12, scaled up from the decimal you see in the web tool. Compare one row with the web report before you add a formula that divides it, and note the scaling in the column header.

Troubleshooting

Most problems show up as an error row or an empty column. Here's what each usually means.

Symptom

Likely cause

Fix

error 400

Malformed URL or missing https://

Clean the URL list

error 403

Key restricted to another API, or API not enabled

Check the key in the Cloud console

error 429

Too many calls in a short window

Raise the pause, check the Quotas tab

error 500

Lighthouse couldn't load the page

Retry alone; check bot blocking and redirects

Script stops at 6 minutes

Apps Script runtime cap

Batch the list across runs

Empty field columns

Too few Chrome visits, or metric names changed

Check the last column and log the keys

Same field values on many rows

Origin fallback

Read the "Field data for" column

Quota numbers for the PageSpeed API itself aren't stated in Google's docs we could find. Third-party guides list 25,000 requests a day and 400 per 100 seconds (Unlighthouse), so check the Quotas tab in your own project before a big run.

Intermittent 500 errors on heavy or protected pages are common enough to have their own threads on the Lighthouse issue tracker. A page that blocks Google's test servers can still open fine in your browser, which makes these confusing the first time.

What can you do with the sheet next?

Once rows build up, the sheet earns its keep. A line chart of Performance score by date per URL shows the effect of each release, and conditional formatting can colour any field LCP above 2,500 ms, Google's good threshold (web.dev Web Vitals).

Example weekly LCP in a sheet with conditional formatting, where the /shop cells turn orange right after a release

For an AI assistant that reads and explains the results, see our guide to PageSpeed Insights MCP servers. If cost is the question, our post on PageSpeed Insights API pricing covers what the free API leaves to you, and Pulldata's current rates are on its pricing page.

The same Apps Script pattern works for other data too. Our walkthrough on sending Google search results to Google Sheets uses it for rank tracking.

PageSpeed Insights Google Sheets FAQ

Can I use IMPORTXML or IMPORTDATA for PageSpeed scores?

Not reliably. The API returns large JSON that those formulas don't parse, and a test takes seconds, so Apps Script is the practical route.

Is there a free PageSpeed add-on for Google Sheets?

We haven't reviewed any, so we can't name one. If you try an add-on, check what access it asks for, since it may want your API key and edit rights.

How many URLs can one sheet handle?

The 6-minute run limit matters more than the sheet's size. Batch the list across several runs, and move to a database once history gets large.

Why is the score in my sheet different from the PageSpeed website?

Lab scores vary between runs. Check that the device matches too, since the API may default to desktop.

Do I need a Google Cloud project?

For the script route, yes, to create the API key. The no-code export route doesn't need one.

Sources were checked on Google's own documentation on Nov 3.

Disclaimer: This article is general information about moving PageSpeed data into Google Sheets. Google's APIs, quotas and Apps Script limits can change at any time, so test the script on a short list before you rely on it; Pulldata is not affiliated with Google.

Share this article
V

Written by

Varun Kumar

Varun Kumar is co-founder of Pulldata, where he leads the data infrastructure behind its products. A backend engineer by training, he has spent 8 years building large-scale scraping and automation systems, and now oversees how Pulldata extracts, validates and delivers web data at scale.

FAQ

Frequently asked questions

Everything you need to know about extracting web data, proxy management, and zero-cost failed rows.

Explore Documentation

Where can I extract public web data from with PullData?

PullData provides ready-to-use scrapers for Google Maps, Google Search SERP, directory listings, company websites, and social platforms, with built-in proxy rotation and automated anti-bot bypass.

Do I need coding skills or proxies to collect data?

No coding or proxy management is required. Everything runs in the cloud. You only configure your target keywords or URLs, and PullData handles rate limits, proxy rotation, and CAPTCHAs automatically.

In what file formats can I download extracted data?

You can export datasets instantly into CSV, Microsoft Excel (XLSX), or JSON. You can also connect directly via Webhook or REST API to sync rows with your database or CRM.

What happens if a scraping job encounters failed rows?

PullData only charges for successfully scraped and verified rows. Any failed row or timeout costs 0 credits, ensuring you only pay for actionable data.

Get Started Free

Ready to extract web data?

No code, no proxies, no engineering overhead. Start with $10 free credits and collect clean public data instantly.

Instant Cloud Setup $10 Free Credits Included Failed Rows Cost $0
Weekly Digest

Get weekly data-extraction insights

One short email a week — new guides, scraper tips, and the occasional teardown. No spam, unsubscribe anytime.