In this tutorial, you’ll learn how to create QR Codes in Google Sheets using formulas. And how to transfer them to Google Docs and Google Slides using Apps Script.
A QR code is a type of matrix barcode.
Barcodes and QR codes are optical labels that are machine-readable and link to information about items or products.
They’re ubiquitous today. You see them everywhere, from restaurant menus to packaging labels.
In this post, we’ll look at how to create fully-functional QR codes in Google Sheets.
QR Codes In Google Sheets
To create QR codes, we call a QR code API (Application Programming Interface) to generate a QR code. Then we display those QR codes in Google Sheets with the IMAGE function.
Let’s see an example.
Assuming we have some information in cell A1, the first step is to encode the data for the API with the ENCODEURL function:
The encoding ensures the data can be used in the query string of the URL when we call the API. For example, we can’t have spaces in URLs, so the ENCODEURL function will replace spaces with a special code (in this case %20).
Anyway, provided you have the ENCODEURL function present, it will take care of that for you.
Next, we prepend the QR Code Generator API request for QR Codes, which will create the QR code:
If you click on the URL generated by this formula, it will open the QR code in a new tab of your browser. So now we need to display the QR code in the Sheet.
To do this, we wrap the formula with the IMAGE function:
There it is! Our QR code in a Google Sheet!
We can now scan this QR code with our phone camera or a QR reader to quickly access that data:
QR Codes Template
Feel free to make a copy: File > Make a copy…
If you can’t access the template, it might be because of your organization’s Google Workspace settings.
In this case, right-click the link to open it in an Incognito window to view it.
My friend, Amit Agarwal, has written a tutorial on how to create dynamic QR codes for collecting UPI payments, using custom functions in Google Sheets.