ENCODEURL in Google Sheets: Query Values and Percent Encoding
Encode Google Sheets query data with documented comma, space and exclamation examples while keeping URL delimiters and raw input separate.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: ENCODEURL(text) encodes text for use in a URL query string. Google’s example specifically turns commas, spaces and exclamation marks into percent-encoded sequences. Build the fixed URL structure separately from the variable data.
Availability and version history
- Introduced: first introduction date is not established by the reviewed official history; no desktop release number is inferred.
- Availability: documented in the rolling Google Sheets service; these examples use the web worksheet workflow.
- Checked: October 14, 2026; official ENCODEURL reference. Documentation and independent models, with no native Sheets execution or wider client certification.
Syntax and the output boundary
=ENCODEURL(text)
The result is an encoded string. Creating that string does not itself require a website request. This tutorial uses fictional addresses and does not call IMPORTHTML, an API or any authenticated service.
Google’s own example shows hello, world! becoming hello%2C%20world%21. The corresponding ASCII byte values are 44, 32 and 33, represented in hexadecimal as 2C, 20 and 21. The formulas below use straight quotation marks even though the reference’s displayed sample contains typographic quotes.
Example 1: encode a list of labels
Enter these values in A2:A5. In B2 enter =ENCODEURL(A2) and fill down:
| Raw text | Expected encoded text |
|---|---|
| Ready, go! | Ready%2C%20go%21 |
| Blue room | Blue%20room |
| A,B | A%2CB |
| Stop! | Stop%21 |
These controls stay within the characters demonstrated by Google’s published output. They preserve the raw information instead of deleting punctuation or replacing every separator with a space.
Keeping A and B side by side lets a reviewer see which text is raw and which is already encoded. A later formula should use the intended column rather than repeatedly applying the function to whichever one happens to look convenient.
Example 2: build one query field
With Blue room in D2, enter:
="https://example.com/search?q="&ENCODEURL(D2)
The constructed string is https://example.com/search?q=Blue%20room. The scheme, slashes, question mark and equals sign are fixed structure; the search term is the encoded data component.
This is an example of string construction, not a statement that the fictional destination implements a search service. Do not open a generated address merely to verify the concatenation; its characters can be checked directly.
Advanced example: two query values
Put Blue room in G2 and Ready, go! in H2. Use:
="https://example.com/report?room="&ENCODEURL(G2)&"&label="&ENCODEURL(H2)
The expected result is https://example.com/report?room=Blue%20room&label=Ready%2C%20go%21. The ampersand separates two fields because it is added as fixed URL syntax, not because it appears in either sample’s raw value.
The IETF URI specification explains percent triplets and why component data must be distinguished from delimiters. That general standard supports the construction model; it is not a substitute for testing every character in the Google Sheets implementation and receiving application.
Why replacing spaces is insufficient
A formula that only replaces spaces could transform Ready, go! to Ready,%20go!. It leaves the comma and exclamation mark unchanged, whereas Google’s demonstrated ENCODEURL behavior encodes both.
That comparison is a concrete reason to use the relevant encoding function rather than a growing sequence of ad hoc replacements. It does not claim that all characters must always be encoded in every URL context; context is exactly why the fixed structure is kept separate.
Avoid processing encoded text twice
In the URI model, a literal percent sign is encoded as %25. Applying percent-encoding again to Blue%20room therefore produces the model string Blue%2520room, which carries a literal percent sequence rather than representing the original space once.
This double-encoding illustration is independently calculated from the URI model; it is not a native Sheets test of every already-encoded input. Preserve the raw input and encode it at the component boundary where the receiving format requires it.
Percent-encoding is reversible and is not encryption. It does not make private data safe to put in a URL, nor prove that a destination is trustworthy. A URL generated from a spreadsheet should still be reviewed before use.
Limits and related functions
The dedicated help does not enumerate all Unicode, length, malformed-input or exact error-code behavior. The certified examples remain within the documented ASCII subset. Non-ASCII values and service-specific query rules need their own checks.
SUBSTITUTE changes specified text but is not a general URL encoder. UNICODE reports a character’s code point rather than a complete encoded URL. Preserve the distinction between generating a string, creating a hyperlink and making an external request.
References and verification
Examples use fictional data, English function names and comma separators. Expected outputs are independent mathematical calculations or explicitly documented rules, not native Sheets captures. Check the spreadsheet locale when reproducing punctuation-sensitive formulas.