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
-
Encoding a simple phrase:
- Example:
=ENCODEURL("hello world") - Result:
hello%20world
- Example:
-
Building a dynamic search URL:
- Example: If
A1contains"google sheets tips", then="https://example.com/search?q=" & ENCODEURL(A1)will build a properly encoded URL.
- Example: If
Use Cases and Scenarios
- Dynamic API Requests: Construct valid URLs for
IMPORTDATAorIMPORTXMLcalls that include variable query parameters. - Search Link Generation: Build shareable search or lookup links from cell values that contain spaces or symbols.
- 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.