I have a Google Sheet with many cells, one of which is a QR code (QR code contains name and Employee ID). A Google Docs file is generated based on the values from the worksheet, by replacing placeholder text. This Google Doc will be used as a digital pass.
How can I place the QR code image in the Google Docs, generated from the Google Sheets data?
Ex. In the sheet, I stored Employee ID
, Name
, and QR Code
in columns A, B, and D.
I use replaceText
to replace placeholder text in the Document
:
copyBody.replaceText('EmployeeID', row[i][0]);
copyBody.replaceText('firstName', row[i][1]);
copyBody.replaceText('qrCode', row[i][3]); etc.
The QR Code is stored in the sheet as a formula result:=IMAGE("https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=" & C2)
When I run my script, the EmployeeID
and Name
fields are replaced in the template document with the desired values, but nothing in the qrCode
fields.