URL Encoding and Decoding in Excel on Mac with UTF-8 Support

Let’s say you downloaded a CSV file containing a report related to an online campaign or a web access report for example, and all the URLs in it are percent-encoded. They are only going to be human-readable if the URLs contain Latin alphanumeric characters, not if they contain Arabic or other non-Latin characters.

Example of URL-encoded Arabic

There are numerous websites that offer quick URL decoding online, but for a CSV with hundreds of entries, they’re not really practical.

I spent a long time trying to write something myself, and an equally long time searching online for ideas. Unfortunately the majority of suggestions I found online either only work on Windows or don’t support UTF-8 (Arabic). Eventually I found a solution that works consistently using some VBA code that is reproduced below almost verbatim from ExcelVBA.ru who referenced a 2016 post on the currently non-functioning zhaojunpeng.com.

How to use it

1. Open your CSV file in Excel and save it as a Macro-Enabled Workbook.

2. Open Visual Basic Editor.

3. Insert a new Module.

4. Copy and paste the code (below) into the code editor window.

5. Close Visual Basic Editor and in your worksheet you will now have two new formulas available URLEncode() and URLDecode().

The Code

1 Comment

Add Yours →

Leave a Reply