Google URL Shortener with Google Scripts

You can use Google Apps Script with the Google URL Shortener API to convert any long URL into a short one served through the goo.gl domain. Make sure you replace key with your own key from the Google Console dashboard. You can also bit.ly to shorten URLs.

The other easier alternative for creating short URLs with the Google URL shortener API doesn’t require you to create a key as it passes the OAuth 2.0 access token for the current user in the header.