How to Generate QR Codes in Excel Without Any Third-Party Tools
🔍 WiseChecker

How to Generate QR Codes in Excel Without Any Third-Party Tools

You need to create QR codes directly in your Excel spreadsheets for inventory, marketing, or data sharing. Excel does not have a built-in QR code button, but it includes a powerful function for this purpose. This article explains how to use the WEBSERVICE and ENCODEURL functions to generate QR codes from your cell data. You will be able to create scannable codes for URLs, text, or contact information without installing any add-ins.

Key Takeaways: Generate QR Codes in Excel

  • WEBSERVICE function: Fetches a QR code image from a free online API directly into your Excel cell.
  • ENCODEURL function: Properly formats your text or URL so it can be used safely in the QR code web request.
  • Insert > Pictures > Place in Cell: Converts the linked online image into a static picture you can move and resize.

Using Excel’s Web Functions to Create QR Codes

Excel can generate QR codes by combining data from your cells with a free public web service. The method uses the WEBSERVICE function, which retrieves data from a specified URL. For QR codes, you point this function to an API that returns an image file. You must have an active internet connection for the initial code generation. Your Excel version must also support dynamic array functions, which includes Microsoft 365 and Excel 2021 or later.

The core formula constructs a web address for the QR code generator API. You insert your data, like a website link or product ID, into this address. Excel fetches the image and displays it as a linked picture. This picture is initially connected to the web. You should convert it to a static image to prevent it from disappearing if the online source changes or your internet is off.

Steps to Create a QR Code in Your Worksheet

Follow these steps to build a QR code from text in a cell. Ensure you are connected to the internet.

  1. Enter your data in a cell
    Type the text or URL you want to encode into a QR code. For example, enter https://www.example.com into cell A1.
  2. Build the formula with ENCODEURL
    In a new cell, start the formula to encode your text. Use =ENCODEURL(A1). This function converts characters like spaces and ampersands into a web-safe format.
  3. Create the full API URL
    Combine the encoded text with the QR code API base URL. In another cell, use this formula: ="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=" & ENCODEURL(A1). This creates the complete web address.
  4. Use the WEBSERVICE function to fetch the image
    In your target cell, use the WEBSERVICE function with the URL. The formula is: =WEBSERVICE("https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=" & ENCODEURL(A1)). This will return the image data as a text string, which Excel can interpret.
  5. Insert the image using a named formula
    Go to the Formulas tab and click Name Manager. Click New. For Name, enter QRCode. In the Refers to box, paste your WEBSERVICE formula. Click OK.
  6. Place the image in your sheet
    Go to the Insert tab, click Pictures, and select This Device. In the file picker, cancel or close it. Instead, click in the formula bar, type =QRCode, and press Enter. The QR code image will appear.
  7. Convert to a static picture
    Right-click the generated QR code image and select Copy. Then right-click on any cell and under Paste Options, select the Picture icon. This pastes a static copy. You can delete the original linked image.

Using a Simpler Method with the IMAGE Function

If you have the latest version of Excel for Microsoft 365, you can use the IMAGE function for a more direct approach.

  1. Construct the image URL
    In a cell, create the QR code API URL as a text string. For example: ="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=" & ENCODEURL(A1)
  2. Use the IMAGE function
    In another cell, enter the formula: =IMAGE("https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=" & ENCODEURL(A1)). Press Enter. The QR code will appear directly in the cell.

Common Mistakes and Limitations to Avoid

Excel Shows a Text String Instead of a Picture

If the WEBSERVICE formula returns a long text string starting with �PNG, the cell is not formatted to show the image. This happens if you skip the step using the Insert > Pictures method. The WEBSERVICE function only fetches the raw data. You must insert it as a picture via the Insert tab or use the IMAGE function to display it visually.

The QR Code Image Does Not Appear or Shows an Error

Check your internet connection, as the formula requires it to call the API. Verify the data in your source cell does not exceed the API’s length limit, which is typically around 2,000 characters. Ensure the URL in your formula is correctly typed and uses the ENCODEURL function for the data parameter. A missing ampersand or equals sign will break the web request.

The Image Disappears When You Save and Reopen the File

The image generated via WEBSERVICE is a live link to the web. If you send the file to someone offline, or if the online API is unavailable, the image may not load. Always use the final step to copy and paste the image as a static picture. This embeds the image in the workbook file independently of the web source.

Excel Says the WEBSERVICE or IMAGE Function Is Invalid

These functions are available in Excel for Microsoft 365 and Excel 2021. They are not available in Excel 2019, Excel 2016, or standalone perpetual license versions. Check your Excel version under File > Account. If you have an older version, you cannot use this native method and would need a VBA macro or an add-in instead.

QR Code Methods in Excel: Comparison

Item WEBSERVICE & Insert Picture Method IMAGE Function Method
Excel Version Required Microsoft 365, Excel 2021 Microsoft 365 (newer updates)
Ease of Use More steps, requires using Name Manager Single formula, more direct
Image Output Linked picture that needs conversion Image embedded directly in cell
Offline Usability After Creation Yes, after pasting as static picture Yes, image is stored in workbook
Ability to Format & Resize High flexibility as a picture object Limited to cell sizing and formatting

You can now create QR codes directly in Excel using built-in functions. Use the IMAGE function for a quick cell-based code or the WEBSERVICE method for more control over the final image. Remember to convert your web-linked image to a static picture to ensure it stays in your file. For advanced use, try embedding the QR code in a cell comment using VBA to create interactive inventory sheets.