ENCODEURL Function (LibreOffice Calc)
The ENCODEURL function converts text into a URL‑encoded string, replacing unsafe characters with percent‑encoded sequences. It is used for web requests, APIs, and constructing safe URLs.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✔ |
| Onlyoffice | ✔ |
| Openoffice | ✖ |
| Wps | ✔ |
| Zoho | ✔ |
What the ENCODEURL Function Does ▾
- Converts text → URL‑safe encoded string
- Replaces spaces, symbols, and non‑ASCII characters
- Ensures compatibility with web servers and APIs
- Useful for building query strings and REST URLs
Syntax ▾
ENCODEURL(text)
Arguments
- text:
The string to encode for safe use in a URL.
Basic Examples ▾
Encode a simple phrase
=ENCODEURL("hello world")
→ "hello%20world"
Encode special characters
=ENCODEURL("A&B=C")
→ "A%26B%3DC"
Encode non‑ASCII characters
=ENCODEURL("café")
→ "caf%C3%A9"
Advanced Examples ▾
Build a full API request URL
="https://api.example.com/search?q=" & ENCODEURL(A1)
Encode multiple parameters
="name=" & ENCODEURL(A1) & "&city=" & ENCODEURL(B1)
Encode JSON for a query parameter
=ENCODEURL("{""id"":123,""active"":true}")
Use with WEBSERVICE
=WEBSERVICE("https://api.example.com/data?key=" & ENCODEURL(A1))
Encode a file path
=ENCODEURL("C:\Users\Nick\My Files\Report 2026.pdf")
Encode a dynamic concatenated string
=ENCODEURL(A1 & " - " & TEXT(B1; "YYYY-MM-DD"))
Edge Cases and Behavior Details ▾
ENCODEURL returns text
Behavior details
- Encodes spaces as
%20(not+) - Encodes reserved characters:
&,?,=,/,#,%, etc. - Encodes UTF‑8 characters into multi‑byte percent sequences
- Does not validate URL structure
- Does not encode entire URLs automatically — only the input text
Invalid input → treated as text
No error is thrown.
Common Errors and Fixes ▾
“The encoded URL doesn’t work”
Cause:
- Encoding the entire URL instead of just parameters
Fix:
- Encode only the parameter values, not the base URL
Double‑encoding
Cause:
- Applying ENCODEURL twice
Fix:
- Ensure encoding happens only once
API rejects request
Cause:
- API expects
+for spaces instead of%20
Fix:
- Use SUBSTITUTE(ENCODEURL(text); “%20”; “+”)
Best Practices ▾
- Encode only the parts of a URL that require encoding
- Always encode user‑generated or dynamic text
- Use ENCODEURL before WEBSERVICE or FILTERXML
- Document encoding assumptions in API workflows
- Avoid double‑encoding by centralizing the encoding step
ENCODEURL is essential for building safe, reliable web requests — especially when working with APIs, query strings, and dynamic user input.
Related Patterns and Alternatives ▾
- DECODEURL — reverse operation
- WEBSERVICE / FILTERXML — web data retrieval
- SUBSTITUTE — custom encoding tweaks
- TEXT functions — formatting before encoding
By mastering ENCODEURL, you can build robust, API‑ready URL construction workflows in LibreOffice Calc.