To put a Google Sheets spreadsheet in an iframe, open it in a browser and choose File > Share > Publish to web. Select the whole spreadsheet or a particular sheet, open the Embed tab, publish it, and copy the iframe code into a website or content system that allows embedded HTML. The published iframe is generally a view-only display; it is not the same as giving someone permission to edit the original sheet.
What a Google Sheets iframe does
An iframe is an HTML element that displays a separate web page inside the current page. For Google Sheets, the embedded page is a published view of spreadsheet content. Visitors can read and, depending on the display and browser, scroll through the embedded sheet without leaving the site. The spreadsheet itself remains hosted by Google; the website contains a frame pointing to Google’s published view, rather than a copy of the spreadsheet.
This distinction matters when planning what viewers can do. An iframe made through Publish to web is designed to show data, not to provide normal collaborative editing. If visitors need to make changes, comment, or work together in Sheets, give them the appropriate access to the spreadsheet and direct them to open it in Google Sheets. Do not assume that an embedded display offers the same controls as the full spreadsheet editor.
How to create and copy the embed code
Use Google Sheets in a web browser. The wording or arrangement of the publishing dialog can change over time, but the basic process is:
- Open the spreadsheet you want to display and check that it contains only information you are comfortable publishing.
- Choose File > Share > Publish to web.
- In the publishing dialog, use the available selection controls to choose the entire spreadsheet or an individual sheet. If the dialog offers a range or display choice relevant to your document, review it before continuing.
- Select the Embed tab rather than the link option.
- Choose Publish and confirm if prompted. Copy the iframe code Google provides.
- Paste the code into your website’s HTML or an approved custom-HTML block, then preview the page and check it at desktop and mobile widths.
Google’s generated code includes a source address and display dimensions. Keep the supplied source address intact unless you have a specific, verified reason to change it. A hand-built URL can omit the published document identifier or display settings and result in an error or an unexpected view. If you later change which sheet is published, revisit the publishing dialog and copy the updated embed code if needed.
Choose what the iframe displays
Publishing an entire workbook can be convenient, but it may expose more than the page needs. If the spreadsheet has several tabs, consider publishing only the sheet that supports the page’s purpose. For example, a public event page might embed a schedule tab rather than a workbook that also contains internal planning notes. A focused embed is easier for visitors to understand and reduces the chance of showing irrelevant material.
Before publishing, review the visible sheet for hidden surprises. Check tab names, cell values, notes, charts, and any linked or imported information that could appear in the published view. Hiding a tab or column is not a dependable privacy boundary. A person who should not see information must not be able to obtain it from the published content; remove sensitive material or create a separate, carefully limited spreadsheet for publication.
Some publishing dialogs provide presentation choices, such as whether to show sheet tabs or other spreadsheet interface elements. These choices affect how the published view appears, not who is allowed to edit the source. If a choice is not available in your dialog, do not rely on a URL parameter found elsewhere on the web as a substitute. Google can change supported options, and manually edited parameters may not behave consistently.
Publish to web versus sharing a spreadsheet
Publish to web creates a presentation intended to be viewable on a website or through a published link. It is different from the ordinary sharing controls, where an owner invites specific people or grants access to people with a link. A spreadsheet shared with a restricted audience may require a Google account and permission; a published version can be broadly accessible, depending on the account and organization settings.
Publishing does not turn the iframe into a private, password-protected section of your site. A page may be difficult to find, but that is not the same as access control. Treat the published data as information that people outside your intended audience might be able to view. If you need to limit viewers, use Google’s sharing permissions or a suitable authenticated service rather than relying on an obscure page address.
Also distinguish the published display from the source file. The iframe normally presents a read-only published view, while the original spreadsheet keeps its own sharing permissions. A visitor who can see the iframe does not automatically gain editing rights to the original file. Conversely, changing the original file’s sharing settings does not make a public embed private if it is still published. Review both publishing status and file permissions when changing access.
Layout, sizing, and mobile display
The code Google supplies includes a width and height. Fixed pixel dimensions can look fine on a desktop but may make a frame too wide for a narrow phone screen or too short to show useful rows. Many website editors let you adjust the iframe’s dimensions or place it inside a responsive container. If you change the HTML, preserve the published source address and use your site platform’s supported approach to make the frame fit its content area.
There is no single ideal height. A short frame may require visitors to scroll inside the spreadsheet, while a tall one takes up more of the page. Consider the amount of data, the surrounding page layout, and whether the embedded view has its own scrolling behavior. Preview the finished page on a phone and with browser zoom increased. If the sheet is difficult to navigate in a frame, a clearly labeled link to open the published view or spreadsheet in a new page may be more usable.
Think about accessibility as well as appearance. Give the iframe a meaningful title if your site editor supports the attribute, and add nearby text explaining what the embedded data represents. Do not rely on color alone to communicate important distinctions in the sheet. Users of assistive technology may find a large spreadsheet harder to explore inside a frame, so provide a useful alternative, such as a descriptive link or a text summary.
Common iframe problems and fixes
- The frame is blank or says access is denied: Confirm that the sheet was published, that the embed code came from the Embed tab, and that the selected sheet is still available. If the document belongs to a managed Google Workspace account, an administrator may restrict publishing.
- The website displays the code as text: The code may have been pasted into a regular text field instead of an HTML or embed block. Use the site editor’s approved HTML feature; some platforms strip iframe code for security.
- The frame is too small or cut off: Adjust the dimensions in the site’s embed settings or use the platform’s responsive iframe feature. Test the page at the widths your visitors are likely to use.
- Recent edits do not appear: Check the publishing dialog for its republishing setting and confirm the published version is current. Reload the page, and consider browser or site caching. A public display can update on a different schedule from what an editor sees in the live spreadsheet.
- Visitors can see the sheet but cannot edit it: That is expected for a typical published embed. Share the actual spreadsheet with the people who need editing access, using the appropriate permission level.
If a frame works in a direct browser visit but not inside a particular website, the issue may be the website’s content security policy or its rules for embedded content. A site administrator may need to allow Google’s published spreadsheet address. Do not try to work around a security policy by adding arbitrary script code; use the host platform’s documentation or support channel.
Privacy and security before publishing
Publishing is a deliberate disclosure decision. Before clicking Publish, remove personal details, confidential business information, credentials, and data that should only be available to a limited group. Check formulas and source tabs too: even if the page is meant to show a simple total, publishing a broader workbook can reveal underlying rows or other tabs that were not intended for the audience.
Google Workspace administrators can control whether users in an organization may publish files to the web. If the option is unavailable or publication is blocked, check with the organization’s administrator rather than trying to bypass the restriction. When a published view is no longer needed, return to File > Share > Publish to web and stop publishing it. Also remove or replace the iframe on your website. For sensitive data, verify the result after unpublishing and check that the page itself is no longer exposing a cached or copied version.
Alternatives to an iframe
An iframe is useful when visitors should see a live published spreadsheet as part of a page, but it is not always the best format. A link is simpler when people can open the sheet separately. A static table or chart may be easier to read on mobile and gives the site owner more control over layout, though it needs a process for keeping the content current. For controlled collaboration, share the spreadsheet directly with named users or an appropriate group rather than embedding a public view.
Google Sites and other website builders may offer an integration that handles the embed for you. These tools can simplify sizing, but they do not change the underlying publication and access considerations. Excel has different sharing and embedding options, so Google Sheets menu paths and generated iframe code should not be assumed to work for an Excel workbook.
Frequently Asked Questions
Can I embed only one Google Sheets tab?
Yes. In File > Share > Publish to web, use the selection controls to choose an individual sheet when that option is available, then copy the code from the Embed tab. Check the resulting page to confirm it shows the intended tab.
Can visitors edit a Google Sheets iframe?
A standard iframe created through Publish to web is meant to display published content, not provide normal editing access. For collaboration, share the original spreadsheet with the relevant people and have them open it in Google Sheets.
Does publishing a sheet make it public?
Publishing makes a version available as a published web view, so treat its contents as broadly accessible. Workspace policies and account settings can affect availability, but an iframe should not be used as a privacy control.
Why does my website remove the iframe?
Many site editors block iframe HTML in ordinary text areas or restrict which external services can be embedded. Use a designated embed or custom-HTML block if permitted, or ask the site administrator to review the platform’s security settings.
Will the iframe update when I edit the spreadsheet?
Published content can reflect changes to the source, subject to the publishing settings and caching. Check the republishing option in the publishing dialog and refresh the page when verifying an update.
Can I embed a private spreadsheet without publishing it?
Access to a privately shared file depends on the viewer’s permissions and account, and an iframe does not bypass those requirements. For a controlled audience, share the file directly and use a link or a supported embedding method that respects the intended authentication.
Related
- Excel Split Screen: How to Jump Between Panes Quickly
- How to Copy Format in Excel Without Copying Cell Data
- How to Insert a Specific Number of Rows in Excel Quickly
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Sunday Service in Google Sheets: Planning and SchedulingYes. Google Sheets can serve as a shared planning sheet for a Sunday church service: use it to…
- How to Make a Weekly Schedule in Google Sheets Step by StepTo make a weekly schedule in Google Sheets, create a grid with time slots down the first column…
- Google Sheets Dropdown Based on Another Cell: GuideYes. In Google Sheets, you can make one dropdown depend on another by creating named ranges for each…
- Remove Duplicates in Excel: A Practical Step-by-Step GuideTo remove duplicate rows in Excel for Microsoft 365 on Windows, select your data, choose Data > Remove…
- How to Freeze a Cell in Excel Without Losing Your PlaceTo keep headings or identifiers visible while you scroll in Excel, select the cell just below and to…
- Excel Day Trading Journal: Build a Useful Trade LogYes—Excel can track day trades, calculate profit and loss, and help you review whether your strategies and rules…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.