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
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=trueNot checked: needs your own link. Google Docs has no public sample we can load.
Test your linkSteps
How to embed Google Docs
- Open the document in Google Docs.
- At the top, clickFilethenSharethenPublish to web
- In the window, click Embed.
- Click Publish.
- 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
- Google Docs Editors Help · Make Google Docs, Sheets, Slides & Forms publicsupport.google.com/docs/answer/183965
- Google Docs API · JavaScript quickstart (sample document)developers.google.com/workspace/docs/api/quickstart/js
- iframecheck live check · main page
Profile updated