Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Embed Google Sheet in WordPress: Step-by-Step

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

This guide shows you how to embed a Google Sheet directly into a WordPress page or post, so visitors can view (and optionally interact with) your data without leaving your site. You'll need a Google account with the sheet you want to share, and WordPress admin access to the page or post where you'll paste the embed code.

What You'll Need

  • A Google account with the spreadsheet you want to embed
  • WordPress admin access (at least Editor role) to edit a page or post
  • A block-based theme or the Classic Editor (the steps work for both)
  • Optional: a plugin like “Google Sheets Plugin” if you want advanced styling, but the native method below needs no plugin

Step-by-Step

  1. Open your Google Sheet in a browser. Make sure the data you want to show is in the first tab, or note the specific tab name if not.
  2. Publish the sheet to the web (this is the key step). Go to File > Share > Publish to web.
  3. In the dialog that appears, choose the Entire document or a specific sheet from the first dropdown. For the second dropdown, choose Web page.
  4. Click Publish. Google will show a confirmation and give you a link. Copy that link – it looks like https://docs.google.com/spreadsheets/d/e/2PACX-.../pubhtml.
  5. Go back to your spreadsheet. Now, in the browser address bar, you'll see the normal edit URL (something like https://docs.google.com/spreadsheets/d/1AbC.../edit#gid=0). Copy the part between /d/ and /edit – that's the spreadsheet ID. For example, if the URL is .../d/1AbC123/edit, the ID is 1AbC123.
  6. Now you'll build the embed URL. Take the publish link you copied in step 4 and replace the pubhtml part with pubhtml?widget=true&headers=false. So the final URL looks like: https://docs.google.com/spreadsheets/d/e/2PACX-.../pubhtml?widget=true&headers=false. The widget=true hides the Google toolbar, and headers=false removes the sheet name header.
  7. In WordPress, open the page or post where you want the sheet. If using the Block Editor (Gutenberg), add a Custom HTML block. If using the Classic Editor, switch to the Text tab.
  8. Paste the following iframe code, replacing YOUR_EMBED_URL with the URL you built in step 6:
<iframe src="YOUR_EMBED_URL" width="100%" height="500" frameborder="0" allowfullscreen></iframe>
  1. Adjust the height attribute to fit your content – start with 500 pixels and increase if the sheet is cut off.
  2. Click Preview to see how it looks. If the sheet appears but is too small or too large, tweak the height.
  3. Click Update or Publish to save the page.

Common Mistakes

  • Using the edit URL instead of the publish URL. The iframe must use the /pubhtml link, not the normal /edit link. The edit link will show a login prompt or a “You need access” error.
  • Forgetting to publish to the web. If you haven't clicked Publish to web, the embed URL will not work.
  • Not setting sharing permissions. Even after publishing, the sheet must be set to “Anyone with the link can view” (or at least “Anyone on the internet can view”) under the Share button. Otherwise, visitors may see a “Request access” screen.
  • Pasting the iframe into a paragraph block. In the Block Editor, you must use a Custom HTML block. Pasting raw HTML into a paragraph block will show the code as text.
  • Using a height that's too small. If the sheet has many rows, a 500px height will show a scrollbar inside the iframe. That's fine, but some users prefer a taller iframe to see more data at once.

Tips

  • Keep the sheet clean. Remove extra columns/rows you don't want to show. The publish feature shows the entire sheet, so hide or delete unnecessary data.
  • Use the gid parameter to show a specific tab. If you publish only a specific sheet, the URL already points to it. But if you publish the entire document, you can add &gid=123456 to the URL to show a particular tab. Find the gid by looking at the end of the edit URL (e.g., #gid=0).
  • Consider a plugin for more control. If you need to style the sheet, hide tabs, or make it responsive on mobile, a dedicated plugin like “Google Sheets Plugin” or “Sheet Plugin” can help, but the native iframe works for most cases.
  • Test on mobile. The iframe width is set to 100%, so it should resize. But check that horizontal scrolling doesn't break your layout – you may need to set scrolling="yes" or adjust the width.
  • Update the sheet after publishing. Changes you make to the original Google Sheet will automatically reflect on your WordPress page, but there can be a short delay (a few minutes).

Troubleshooting

  • “You need access” or 404 error. This usually means the sheet isn't published to the web, or the sharing link is set to “Restricted.” Go back to Google Sheets, click Share, set “Anyone with the link” to “Viewer,” and re-publish if needed.
  • Blank iframe. Check that you copied the entire URL correctly, especially the /e/ part (if present). Also ensure you used pubhtml, not pub.
  • Sheet appears but is cut off. Increase the height attribute. Alternatively, use scrolling="yes" in the iframe to allow scrolling inside the iframe.
  • Layout breaks on mobile. The iframe width is 100%, but the sheet itself may have a minimum width. Try setting the iframe width to a fixed pixel value (e.g., 600px) and use CSS to make it responsive, or use a plugin that offers a mobile-friendly embed.
  • Changes not showing. Google caches the published version. Wait a few minutes, or re-publish the sheet to force an update.

Frequently Asked Questions

Can I embed a Google Sheet without making it public?

No, the native embed method requires the sheet to be published to the web, which makes it accessible to anyone with the link. If you need to restrict access, you'll need a plugin that uses the Google Sheets API with authentication, but that's more complex.

How do I show only a specific range of cells?

The native publish method shows the entire sheet. To show only a range, you can either hide the rows/columns you don't want, or use a plugin that supports range selection. Alternatively, you can create a new sheet that only contains the range you want to show.

Will the embed update automatically when I edit the Google Sheet?

Yes, the published version updates automatically, but there may be a delay of a few minutes. If you need immediate updates, re-publish the sheet after major changes.

Can I embed a Google Sheet in a sidebar widget?

Yes, you can use a Custom HTML widget in many themes. Add the iframe code to the widget, and it will appear in the sidebar. Note that the iframe height should be small enough to fit the sidebar width.

Why is my iframe showing a scrollbar inside the page?

That's normal if the sheet's content is taller than the iframe height. You can increase the height attribute to reduce the scrollbar, or set scrolling="no" to hide it (but then users can't scroll to see more data).

Is there a way to embed a Google Sheet without iframe?

Yes, you can use the Google Sheets API with a plugin to display data as an HTML table. This gives you more styling control but requires more setup.