This page is for sheets that build codes from several columns, or that need the files afterwards. If you only want a code for each link in a column, the Google Sheets guide has the one formula you need.
One ENCODEURL per field
Every value that comes from a cell goes through ENCODEURL, and every literal part (the endpoint and the parameter names) stays in quotes:
=IMAGE("https://qrcodesforever.com/qr.png?ssid=" & ENCODEURL(A2) & "&password=" & ENCODEURL(B2))
With Cafe Guest in A2 and coffee123 in B2, Sheets requests /qr.png?ssid=Cafe%20Guest&password=coffee123, and the code contains WIFI:T:WPA;S:Cafe Guest;P:coffee123;;. Phones read that as "join this WPA network with this password".
Leave out an ENCODEURL and the code changes without any error. A password like fish&chips would end at fish, because the API reads &chips as the start of a new parameter.
Formulas for other kinds
Contact card, with first name, last name, phone and email in A to D:
=IMAGE("https://qrcodesforever.com/qr.png?type=vcard&first=" & ENCODEURL(A2) & "&last=" & ENCODEURL(B2) & "&phone=" & ENCODEURL(C2) & "&email=" & ENCODEURL(D2))
The type=vcard matters here. Without it, a row with an empty first and last name would fall through to the email or phone kind. For Ada Lovelace, +441234567890 and ada@example.com, the code is a 137-byte vCard 3.0 and comes out as version 8, a 49×49 grid. Contact codes are dense, so make those rows taller than the others.
WhatsApp chat, with the number (country code, no +) in A2 and a message in B2:
=IMAGE("https://qrcodesforever.com/qr.png?type=whatsapp&whatsapp=" & ENCODEURL(A2) & "&message=" & ENCODEURL(B2))
For 919876543210 and Hi, the code contains https://wa.me/919876543210?text=Hi.
UPI payment, with the UPI ID in A2 and the amount in B2:
=IMAGE("https://qrcodesforever.com/qr.png?upi=" & ENCODEURL(A2) & "&amount=" & B2)
A number needs no encoding. For shop@okaxis and 250, the code contains upi://pay?pa=shop@okaxis&am=250.00&cu=INR. The parameter reference lists every kind and field.
Keep the URL in its own column
Put the request in C2 as text, and the image in D2:
C2: ="https://qrcodesforever.com/qr.png?url=" & ENCODEURL(A2) & "&fg=1d3fd6"
D2: =IMAGE(C2)
This pays off the first time a cell stays blank. IMAGE shows nothing when the API answers with an error, and Sheets doesn't tell you why. Copy C2 into a browser and you get the API's own message: a 400 with Missing or invalid content. Try ?url=example.com, ?upi=name@bank or ?type=wifi&ssid=MyWifi, or a 413 when the data is too long for one code. Common causes are a link with no real domain, an empty network name, or a vCard row with no name or company.
Two Sheets rules apply to that URL. IMAGE can't show SVG, so always use /qr.png. And Google's IMAGE documentation says the URL can't refer to volatile functions such as NOW() or RAND(), so cache-busting tricks won't work. You don't need one, because the same URL always returns the same image.
For a fixed size, use mode 4 with a height and width in pixels: =IMAGE(C2, 4, 120, 120). No mode resizes the cell, so set the row height yourself.
Save every code to Drive
IMAGE shows codes but doesn't give you files. This Apps Script (Extensions, then Apps Script) fetches each row's PNG and saves it to a new Drive folder. It expects a file name in column A and a link in column B:
function saveQrCodes() {
const sheet = SpreadsheetApp.getActiveSheet()
const rows = sheet.getRange(2, 1, sheet.getLastRow() - 1, 2).getValues()
const folder = DriveApp.createFolder("QR codes")
for (const [name, link] of rows) {
if (!link) continue
const url = "https://qrcodesforever.com/qr.png?size=1024&url=" + encodeURIComponent(link)
folder.createFile(UrlFetchApp.fetch(url).getBlob().setName(name + ".png"))
}
}
The first run asks for permission to use Drive and make external requests. UrlFetchApp.fetch throws on a 400, so a bad row stops the script with the API's message in the log. Fix that row and run it again.
If you'd rather not touch code, download the sheet as a CSV and drop it into the bulk QR code generator. It makes every file in your browser and hands you a ZIP.
What leaves your sheet
Every value in the formula is sent to our server as part of the URL, because that's how the API knows what to draw. That's fine for links and product codes. It's a poor fit for a column of Wi-Fi passwords for private networks. For those, make the codes in the generator, which never sends them anywhere.
Still using the old chart.googleapis.com formula? It stopped working years ago; the Google Charts migration guide maps it to ours. The same approach in Excel is on the Excel API page.