Learn how to generate a QR code with Excel! QR codes are an easy way to share information like URLs, contacts or locations with a mobile app. In this guide, we'll demonstrate the process of converting cell data into a QR code by utilizing an API alongside Excel's IMAGE function.
- What is an API? An API is a program that you call through a URL
- Argument of the API. Then, you must fill in arguments to return your QR Code
- IMAGE function. To convert the result of the API to a QR Code, you must use the IMAGE function of Excel 365
- Convert the result as a picture. Last step, you must convert the result returned by the IMAGE function to a picture
What is an API?
To generate a QR Code we will use an API. But what is an API?
- An API, or Application Programming Interface, is a program that simplifies complex tasks.
- An API is a URL. Behind the URL there is a program.
- By sending arguments to the URL, you give more details to the API to return what you expect.
To generate a QR code with Excel, you will need to use the following API:
https://chart.googleapis.com/chart?
After that, you need to add these 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 about the arguments, you can refer to the following address
The IMAGE function
The IMAGE function is available in Excel 365, Excel Online and Excel 2019. You can display an image in a cell directly from its URL address.
Since the API is a URL, the IMAGE function will convert the URL to a QR code for you 😎
Creation of the QR Code
- To create a QR code with Excel, you must 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.
= "https://chart.googleapis.com/chart?cht=qr&chs=400x400&chl="&A2
- If you aren't familiar with the & symbol, go to this article for more explanations
- And to convert the API into an image, you just have to embed the API in the IMAGE function.
=IMAGE("https://chart.googleapis.com/chart?cht=qr&chs=400x400&chl="&A2)
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. The first link is the Niagara Falls 👍
Convert QR code to image
However, there is one problem.
- QR codes result from a formula, so you can't export them to another support as is.
- You must convert each QR code into an image to solve this issue.
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 😀👍
Nikos Nt
09/08/2023 @ 10:52
Very helpful and thank you.
I have one issue though, when i save the excel file and reopen it , all the QR code have an error #Field. When i double click the cell and press enter at formula the QR appears again. could you provide me a solution?
Thank you very much
Frédéric LE GUEN
24/08/2023 @ 12:07
Hi, Have you converted the result in picture?
Richard
15/03/2023 @ 14:23
Good afternoon,
Why would the below formula not work anymore? it was working perfectly until last Friday.
=IMAGE("https://chart.googleapis.com/chart?cht=qr&chs=400x400&chl="&A2)
Thank you,
Richard
Frédéric LE GUEN
18/03/2023 @ 08:33
No idea. I haven't tried recently