Excel Function: ENCODEURL
Purpose
The ENCODEURL function replaces all non-ASCII & URL reserved characters in a text value with URL escape codes.
The output of ENCODEURL is text which can be included in a URL.
Invocations of the ENCODEURL function take the form:
ENCODEURL(text)
Limitations
- The ENCODEURL function does not work on either Apple Macs, or Excel for the web.
- The ENCODEURL function does not check if its output is a valid URL.
- It can generate invalid URLs by replacing URL reserved characters with URL escape codes.
Arguments
Argument | Argument type | Description |
---|---|---|
text | Mandatory | The text to be encoded. |
Related Functions
Function(s) | Example | Purpose |
---|---|---|
FILTERXML, WEBSERVICE | FILTERXML(WEBSERVICE(ENCODEURL(url)),xpath) | Sanitise a URL, use it to call a web service, then extract data from the response. |
HYPERLINK | HYPERLINK(ENCODEURL(url),[friendly_name]) | Sanitise a URL, then create a clickable link to the resource located at it. |
WEBSERVICE | WEBSERVICE(ENCODEURL(url)) | Sanitise a URL, then use it to call a web service. |
Examples
Example | Description | Formula | Result |
---|---|---|---|
1 | Encode an entire URL.
| =ENCODEURL("https://www.abcd.com") | https%3A%2F%2Fwww.abcd.com |
2 | Encode the parts necessary to generate a valid URL.
| =ENCODEURL("https")&"://"&ENCODEURL("abcd.com") | https://www.abcd.com |
3 | Encode a text value which is not a URL.
| =ENCODEURL("Lorem ipsum dolor sit") | Lorem%20ipsum%20dolor%20sit |
4 | Encode a numeric value.
| =ENCODEURL(123.456) | 123.456 |
5 | Encode non-ASCII characters.
| =ENCODEURL("€ ü") | %E2%82%AC%20%C3%BC |