Docs & officedocs.google.com/document

Can you embed Google Docs in an iframe?

Yes. Use File, Share, Publish to web to get the embed code. Google documents only the published copy for embeds, and visitors see a read-only version.

Checked Test again

Live check

What the main page sends

Result of
Edit linkEmbeddable
docs.google.com/document/d/195j9eDD3ccgjQRttHhJPymLJUCOUjs-jmwTrekvdjFE/edit
X-Frame-Options
Not sent
CSP frame-ancestors
Not sent
Response
200 OK · 398 ms · HTTPS
Published linkNot checked
docs.google.com/document/d/e/{published-id}/pub?embedded=true

Not checked: needs your own link. Google Docs has no public sample we can load.

Test your link

Steps

How to embed Google Docs

  1. Open the document in Google Docs.
  2. At the top, clickFilethenSharethenPublish to web
  3. In the window, click Embed.
  4. Click Publish.
  5. Copy the HTML in the text box. Paste it into your page.

Publishing makes the document visible to the audience you choose.

Check the document for private data before you publish it. Stop publishing to remove access.

Embed code

Paste this into your page

HTML
<iframe
  src="https://docs.google.com/document/d/e/{published-id}/pub?embedded=true"
  width="100%"
  height="600"
  style="border: 0"
  title="{document title}">
</iframe>

Use the src from the embed code that Google gives you. The published ID is not the document ID.

URL patterns

Swap the link you have for the embed URL

  • You have…/document/d/{doc-id}/editUse in the iframe…/document/d/e/{published-id}/pub?embedded=true

You cannot make the published link from the edit link. Get it from Publish to web.

Good to know

  • Visitors see a version with no toolbar. They cannot edit it.
  • Changes show automatically while "Automatically republish when changes are made" is checked under Published content & settings.
  • In work or school accounts, the administrator can turn off publishing.
  • In work or school accounts, you can publish to everyone on the web, your organization, or a group in it.
  • To stop, open File, Share, Publish to web, then Published content & settings, then Stop publishing.

Sources

Profile updated

Know before you embed.

Free, no sign-up, nothing stored. Paste a URL and get a verdict, a live preview, and the fix.