Embed a Google Sheet in Google Sheets
Create embed code in B2. Enter exactly ="<iframe src="""®EXREPLACE(A2,"/edit.*$","/preview")&"""></iframe>". Do not change the source URL.
Verified by JosephineAbout 60 secondsCreate embed code in B2. Enter exactly ="<iframe src="""®EXREPLACE(A2,"/edit.*$","/preview")&"""></iframe>". Do not change the source URL.
Step-by-step
Select the targetCreate embed code in B2.
Apply the changeEnter exactly ="<iframe src="""®EXREPLACE(A2,"/edit.*$","/preview")&"""></iframe>".
Shortcut or faster method
Select the target cell, type or paste the formula in the formula bar, then press Enter.
Expected result
B2 contains an iframe whose source uses the spreadsheet preview URL.
Common mistake
Changing the source values while applying the formatting or structure change.
Troubleshooting
Re-select B2 and repeat the final action. B2 contains an iframe whose source uses the spreadsheet preview URL.
Example spreadsheet data
This is the clean fixture used for the verified run.
| Published sheet URL | Embed code |
| https://docs.google.com/spreadsheets/d/1SheetStepsExample/edit#gid=0 |
Video transcript
- Open the prepared Practice spreadsheet.
- Select the target. Create embed code in B2.
- Apply the change. Enter exactly ="<iframe src="""®EXREPLACE(A2,"/edit.*$","/preview")&"""></iframe>".
- B2 contains an iframe whose source uses the spreadsheet preview URL.