Is it possible to convert text from a certain cell to RFC 3986 (http://url-encoder.org/) in a Google Spreadsheet?
Lets say C4 has the value John Doe, then D4 must be John%20Doe.


4 Answers 4


Yes, you can create a custom function for that.

Click Tools → Script Editor. Select Create blank project.

In the script editor window, paste the following code:

function encode(value) {
  return encodeURIComponent(value);

Save the script (give it a name if prompted), and return to your spreadsheet.

Now, you may use the function as =encode. If your C4 cell contains the text John Doe, enter the following in your D4 cell: =encode(C4).

D4 should now display John%20Doe.

I have created an example spreadsheet to demonstrate.

  • 4
    This was an excellent answer when it was given. There is now a native function =ENCODEURL within Sheets for this (see below). Nov 9, 2018 at 16:01

For other's reference - a similar method also works for decode.

function decode(value) {
  return decodeURIComponent(value);

You can do this without a custom function using ENCODEURL.



For others who are still searching for this, Google Sheets has a function called ENCODEURL now (Aug 2018), so you don't need to make your own any more.

  • Wish I'd seen this first! Nov 9, 2018 at 15:59
  • but no decode! wtf?
    – Anoyz
    Mar 24, 2021 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.