Developers

Using the QR code API in Excel

Excel's IMAGE function can call the QR code API directly: build the request from cells with &, encode each value, and pass it to IMAGE. On Windows, ENCODEURL does the encoding. On Mac and the web it doesn't exist, so a SUBSTITUTE chain does the job. Keep each request under Excel's 255-character URL limit.

For a code per link in one column, the Excel guide is all you need. This page is for workbooks that build codes from several fields, run on Mac or the web, or hit Excel's limits.

Microsoft's IMAGE function is available in Excel for Microsoft 365 (Windows, Mac and the web), Excel 2024, and Excel on iPhone and Android. Excel 2021 and older don't have it; use the bulk generator there instead.

Windows: ENCODEURL around every cell

=IMAGE("https://qrcodesforever.com/qr.png?ssid="&ENCODEURL(A2)&"&password="&ENCODEURL(B2), "Wi-Fi QR code")

With Cafe Guest and coffee123 in A2 and B2, the code contains WIFI:T:WPA;S:Cafe Guest;P:coffee123;;. The second argument is alt text for screen readers.

A contact card from four columns:

=IMAGE("https://qrcodesforever.com/qr.png?type=vcard&first="&ENCODEURL(A2)&"&last="&ENCODEURL(B2)&"&phone="&ENCODEURL(C2)&"&email="&ENCODEURL(D2), "Contact QR code")

Keep type=vcard. Without it, a row missing both names would be read as an email or phone code. The other type values are in the parameter reference.

Mac and the web: encode with SUBSTITUTE

Microsoft's ENCODEURL page says it isn't available in Excel for the web or Excel for Mac. It may show up in the Mac function list, but it relies on Windows and returns nothing useful there. This chain encodes the five characters that change how our API reads a value. % has to go first, or the later replacements get encoded twice:

=IMAGE("https://qrcodesforever.com/qr.png?url="&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"%","%25"),"&","%26"),"#","%23"),"+","%2B")," ","%20"), "QR code")

Writing that once per field gets old fast. In Excel for Microsoft 365, give it a name with LAMBDA. Open Formulas, then Name Manager, then New, call it QRENC, and set it to refer to:

=LAMBDA(v, SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(v,"%","%25"),"&","%26"),"#","%23"),"+","%2B")," ","%20"))

Then any formula in the workbook can call it:

=IMAGE("https://qrcodesforever.com/qr.png?ssid="&QRENC(A2)&"&password="&QRENC(B2), "Wi-Fi QR code")

Skipping the encoding fails quietly. https://shop.com/?a=1&b=2 sent raw produces a code for https://shop.com/?a=1, and +441234567890 sent raw produces tel:441234567890, with the + turned into a space and dropped.

The 255-character limit

Microsoft's IMAGE documentation limits the source URL to 255 characters. The contact card request above, for Ada Lovelace with a phone number and email, comes to 114 characters once encoded. Add a street address, company and website and you can pass 255, at which point the cell shows an error instead of a code.

Microsoft's suggested workaround is to put the URL in its own cell and point IMAGE at that cell. Building the request in a helper column has a second benefit: when a code doesn't appear, you can paste that cell into a browser and read the API's error message. A 400 means the content is missing or invalid (a link with no real domain, an empty network name, a contact with no name or company). A 413 means the data won't fit in one QR code.

IMAGE also refuses URLs that redirect. Ours don't: https://qrcodesforever.com/qr.png?... answers with the image directly.

Sizing

The third argument controls size. 0, the default, fits the code in the cell and keeps it square. 3 takes a custom height and width in pixels:

=IMAGE(C2, "QR code", 3, 120, 120)

The cell doesn't grow to fit, so set row heights yourself. The PNG is 512 pixels square by default, more than enough for any cell. Add &size=1024 to the URL only if you'll print the sheet large.

Moving a workbook off chart.googleapis.com? That service returned a 404 when we tested it on 1 December 2026. The Google Charts migration guide maps its parameters to ours, and the Google Sheets version of this page covers Apps Script for saving files.

Written by Last updated