How to Shorten a URL on Excel and Google Sheets

Created on 13 May, 2024Tutorial • 1,135 views • 6 minutes read

A URL shortener is a website or app that takes a long, messy web address and tidies it up. It's like a makeover for links!

A URL shortener is a website or app that takes a long, messy web address and tidies it up. It's like a makeover for links!

Imagine you have a super long URL that looks like this:


Yikes, that's a spoonful! But with a URL shortener, you can make it into something simple and easy to share, like:


The shortened link still takes you to the same website, but it's way more user-friendly. You can use these short links anywhere - in social media posts, emails, presentations, or even print materials. They're especially handy when you're limited on space or want to make your links look nicer.

Plus, many URL shorteners give you extra features like tracking how many people click on your links. So if you're trying to promote something online, a shortener can help you see how well your links are performing.

Choosing a URL Shortening Service

To select a URL shortener service, consider the features and analytics that are important to you. Here are some popular options:

Bit.ly: Bit.ly lets you string up short links with branded domains. It has detailed link analytics and tracking features.

Bit.ly is particularly useful in social media platforms where, more often than not, characters are limited. Formerly Twitter, and now X, has this issue. You can have a link-in-bio solution, custom QR codes, and many more features that simplify social media marketing. Thistle is why it is a popular choice for marketers and content creators.

TinyURL: A straightforward and convenient free link shortener, TinyURL is simple to use and doesn't require an account. It's a great option for casual users who want a quick and easy way to shorten links.

Google's URL Shortener (Goo.gl): Google's URL shortener offers a reliable service that is easy to use. Plus, it's a well-established and trusted brand. This a very good choice for those who want a simple and hassle-free URL shortening solution.

Things to keep in mind before choosing URL Shorteners

There are new URL shorteners popping up every day. It can be a hassle to go through each and every one of them. When choosing a URL shortener, consider these key factors:

Ease of use: Look for a service that is straightforward and intuitive to use. The process of shortening links should be quick and simple, without requiring too many steps or complicated settings.

Customization: Customizable short links can help reinforce your brand and make your links more memorable. Choose a service that allows you to create short links with your own branded domain or specific keywords.

Analytics: Detailed analytics and tracking are essential for understanding how your shortened links are performing. Look for a service that provides valuable insights like click-through rates, referral sources, and geographic data.

Cost: Decide if you need a free service or if you're willing to pay for additional features. Many URL shorteners offer both free and paid plans, so consider your budget and requirements.

Shortening URLs in Google Sheets

Shortening URLs in Google Sheets is a simple process that can overwhelmingly ease up the sharing and access of files. To achieve this, you need to use the "Shorten URL" function, which is available in Google Sheets.

This function takes a long URL and converts it into a compact and easy-to-share format. Here's how you can create short URLs in Google Sheets:

Sign Up and Access the Dashboard: Once you have chosen a URL shortener service, visit their website and sign up for an account if necessary. This will give you access to a dashboard or interface where you can enter the long URL that you want to shorten.

Paste the Long URL and Generate the Short URL: Copy the long URL from your Google Sheets document and paste it into the provided field on the URL shortener service's dashboard. Click on the "Shorten" or "Generate" button to create the short URL. The service will then generate a unique and compact URL that you can use.

Copy and Paste the Short URL: Copy the short URL and paste it into your Google Sheets document. You can insert it into a cell or add it as a hyperlink. This compact link makes it easier for recipients to access your document without having to type or remember the long URL.

Shortening URLs in Excel

You can shorten URLs in Excel using VBA macros. For this, you need to create a custom function that interacts with a URL-shortening service's API. Here's a pieced-together explanation of how it works:

Automating URL Shortening

First, you need to obtain an API token from the URL-shortening service you want to use. For example, if you choose Bit.ly, you'll need to sign up for a free account and get an access token. This token is used to authenticate your API requests.

After you have collected your token, go to your Excel VBA editor. Create a new module and define a function that will interact with the URL-shortening service's API. This function should take the long URL as an input and return the shortened URL.

Within the function, use the “WinHttpRequest” object to send a GET request to the API endpoint. The endpoint should include the API token and the long URL. For example, if you're using Bitl.y, the URL might look like this:

https://api-ssl.bitly.com/v3/shorten?access_token=your_token&longUrl=long_url.

The API response will contain the shortened URL. You can parse this response using VBA's string manipulation functions, such as “InStr” and “Mid”. These functions help you extract the shortened URL from the response text.

Once you've extracted the shortened URL, you can return it from the function. This can be done by assigning the shortened URL to a variable or by displaying it in a cell.

Example Code:

Sub ShortenURL()

    Dim Token As String

    Token = "your_bitly_token"

    Dim LongURL As String

    LongURL = "http://example.com/long/url"

    Dim HttpReq As New WinHttpRequest

    Dim response As String

    Dim BeginCar, EndCar As Integer

    Dim BitlyResult As String 

    EndAPI = "https://api-ssl.bitly.com/v3/shorten?access_token=" & Token & "&longUrl=" & LongURL

    On Error Resume Next 'This is to avoid errors on invalid URLs

    With HttpReq

        .Open "GET", EndAPI, False

        .Send

    End With

    response = HttpReq.ResponseText

    HttpReq.WaitForResponse

    BeginCar = InStr(response, "hash")

    EndCar = BeginCar + 15

    BitlyResult = Right(Mid(response, BeginCar, (EndCar - BeginCar)), 7)

    MsgBox "The shortened URL is: http://bit.ly/" & BitlyResult

End Sub

Using Excel Functions

The most commonly used excel functions are:

HYPERLINK Function: The HYPERLINK function in Excel can be used to create clickable links that shorten URLs manually.

Syntax: =HYPERLINK("URL", "Link Text")

VBA Macros: With VBA macros, you can create a custom function to interact with a URL shortening service's API to shorten URLs directly within Excel.

This allows for automating the URL shortening process

TinyURL Connector: The TinyURL Connector can be installed from the Connectors Manager in Excel.

It provides a formula to convert long URLs into shorter ones, like

 =Connector("TinyUrl.TinyUrl(string input, int delay) : string

Cutt.ly Integration: Services like Cutt.ly offer integrations with Excel to automatically shorten new links inserted in your Excel sheets.

This streamlines the workflow by shortening URLs as they are added to the spreadsheet.

Consider Other Tools

Apart from Bit.ly, you can explore other URL-shortening services like TinyURL or custom connectors like the TinyURL Connector for Excel.

These tools offer different features and integrations that can help you shorten URLs efficiently within Excel.