Embed Google Sheet Cells and Ranges in Documents and Emails
With Document Studio, you can embed a specific range of cells from Google Sheet in your emails and generated documents. The cell values and ranges can be embedded inside the email subject line, message body, Google Document, Google Sheet, and Google Slide presentations.
The Google Spreadsheet that contains the cell values or ranges should either be owned by you or shared with your Google account.
Embed Spreadsheet Cells Syntax
The default syntax for embedding spreadsheet ranges in documents and emails is:
{{ Embed RANGE, Spreadsheet Id, address=SheetName!CellRange }}
- Spreadsheet Id - The ID of the Google Spreadsheet that contains the cell values or ranges.
- SheetName - The name of the Google Sheet (workbook) inside the spreadsheet that contains the cell values.
- CellRange - The range of cells that you want to embed in the email or the generated document.
For instance, A1:B2
will embed the values from cells A1, A2, B1 and B2. You can also embed single cells like A1
.
Embed Cells Example
We have a sample spreadsheet and we want to embed the values from cells A1 to C5 in our document. The embed formula would be:
{{ Embed RANGE, 1Vqkv4Jma9Hr5TGRcSQzzFhBr8-Grf1sL-nnrrQxFY28, address=Prices!A1:C5 }}
Google Spreadsheet Id
The Spreadsheet Id can be found in the Google Spreadsheet URL itself. For instance, if the spreadsheet URL is:
https://docs.google.com/spreadsheets/d/1Vqkv4Jma9Hr5TGRcSQzzFhBr8-Grf1sL-nnrrQxFY28/edit#gid=0
The Spreadsheet Id is the string between /d
and /edit
and, in this case, is 1Vqkv4Jma9Hr5TGRcSQzzFhBr8-Grf1sL-nnrrQxFY28
.
Sheet Name
The spreadsheet has two worksheets - Prices and BTC. Since we want to embed the values from the Prices sheet, we have specified the sheet name as Prices.
Embed Single Cell
If you want to embed the value from cell A1 in your document, the embed formula would be:
{{ Embed RANGE, 1Vqkv4Jma9Hr5TGRcSQzzFhBr8-Grf1sL-nnrrQxFY28, address=Prices!A1 }}
Embed Cell Range
If you want to embed the values from cells A1 to C5 in your document, the embed formula would be:
{{ Embed RANGE, 1Vqkv4Jma9Hr5TGRcSQzzFhBr8-Grf1sL-nnrrQxFY28, address=Prices!A1:C5 }}
Cell range markers can be embedded inside emails, Google Documents, sheets and Slide presentations. The cell values will be dynamically replaced with the actual values from the Google Spreadsheet when the document is generated.
When a spreadsheet range is embedded in a document, the values are added as plain text. However, if you embed the range in the email body, the spreadsheet data is embedded as a table and the original cell formatting is applied as in the case of Email Google Sheets.