Learn how to generate a QR code with Excel! QR codes are an easy way to share information like URLs or locations with a mobile app.
In this article, we will show you how to encode the contents of your cells into a QR code using an API and the IMAGE function in Excel.
What is an API, you ask?
We will use an API to automatically encode the data of a cell in a QR code.
- An API, or Application Programming Interface, is a program that simplifies complex tasks.
- To use an API, you call it with a URL
- You can send arguments to the URL to perform the task.
To generate a QR code with Excel, you will need to use the following API: https://chart.googleapis.com/chart?
After that, you will need to add three mandatory arguments:
- cht=qr: the type of code to return
- chs: the size of the image (a square of the kind 300x300)
- chl: the source to encode
For complete documentation, you can refer to the following address
The IMAGE function
The IMAGE function, which appeared in Excel 365 and Excel Online at the end of 2022, allows you to display an image from a certified https source in an Excel cell.
Since the API is a URL, the IMAGE function can create the QR code for you 😎
Creation of the QR Code
- To create a QR code with Excel, you simply need to link the API with its three arguments and the cell's contents.
- To link the API string with the cell content, you need to use the symbol &.
Let's take the URLs of these Google Maps locations.
Then, we link the API with the cell's content.
And to convert the API into an image, you just have to embed the API in the IMAGE function.
Download the file with 4 examples
How to check QR Code?
After creating the QR codes, you can check to see if they work by scanning them with a mobile phone.
The mobile apps will open Google Maps with the location you encoded in the QR code.
Convert QR code to image
However, there is one problem.
- QR codes are the result of a formula, so you can't export them to another support as is.
- To solve this issue, you must convert each QR code into an image.
To do this:
- Copy the cell containing the QR code
- Open the Paste Special menu
- select Picture and export the image
With these simple steps, you can generate and export QR codes with Excel quickly and easily 😀👍
15/03/2023 @ 14:23
Why would the below formula not work anymore? it was working perfectly until last Friday.
Frédéric LE GUEN
18/03/2023 @ 08:33
No idea. I haven't tried recently