Back to Functions

ENCODEURL

Encodes a string of text for the purpose of using in a URL query.

WebENCODEURL(text)

The ENCODEURL function in Google Sheets encodes a string of text so it can be safely used within a URL query, converting spaces, symbols, and special characters into their percent-encoded equivalents. It's especially useful when building dynamic URLs for use with import functions or API calls. Dive into our comprehensive guide to master its application.

Parameters

  • text: The text string you want to encode for use in a URL.

Step-by-Step Tutorial

  1. Encoding a simple phrase:

    • Example: =ENCODEURL("hello world")
    • Result: hello%20world
  2. Building a dynamic search URL:

    • Example: If A1 contains "google sheets tips", then ="https://example.com/search?q=" & ENCODEURL(A1) will build a properly encoded URL.

Use Cases and Scenarios

  1. Dynamic API Requests: Construct valid URLs for IMPORTDATA or IMPORTXML calls that include variable query parameters.
  2. Search Link Generation: Build shareable search or lookup links from cell values that contain spaces or symbols.
  3. Data Integration: Safely pass user-generated text into third-party web services through URL parameters.

Related Functions

  • HYPERLINK: Creates a clickable link within a cell.
  • IMPORTXML: Imports data from an XML or HTML feed at a given URL.
  • IMPORTDATA: Imports data at a given URL in .csv or .tsv format.

Related Articles

Newsletter

More ENCODEURL examples coming soon.

We are building short, practical updates for Sheets power users.