Spreadsheet Support

Some Bitly API Endpoints support a txt format response which is useful for integration with Spreadsheets.

View the Bitly API Spreadsheet Example for an example using the Bitly API from Google Spreadsheets.

A Brief Warning

These docs are provided as examples and starting places.

Due to limitations and fragility in how Google Spreadsheets work with foriegn data, we can make no guarantees that these examples will work for your use and we generally cannot provide support for debugging specific spreadsheet issues.

Google Spreadsheets - Creating Bitlinks

  1. Generate a Bitly API Generic Access Token for the account you wish to use to create Bitlinks.
  2. Put the Bitly Access Token in a Cell (for example D1) and give the cell a Named Range of ACCESSTOKEN. You can set Named Ranges from Data -> Named ranges.
  3. Add the Long URL you want to Create a Bitlink for in Cell A1
  4. In Cell B1 Paste the following function to create a Bitlink

=IF(ISURL(A1), IMPORTDATA(CONCATENATE("https://api-ssl.bitly.com/v3/shorten?format=txt&access_token=", ACCESSTOKEN, "&longUrl=", SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE(A1,"%","%25"), "=","%3D"), "&","%26"), "?","%3F"), "#","%23"))), "")

Google Spreadsheets - Bitlink Click Metrics

  1. Generate a Bitly API Generic Access Token
  2. Put the Access Token in a Cell (for example D1) and give the cell a Named Range of ACCESSTOKEN. You can set Named Ranges from Data -> Named ranges.
  3. Add the Bitlink you want to lookup metrics for in Cell A1
  4. In Cell B1 Paste the following function to lookup Bitlink Click Counts

=IF(ISURL(A1), IMPORTDATA(CONCATENATE("https://api-ssl.bitly.com/v3/link/clicks?format=txt&unit=day&units=-1&rollup=true&access_token=", ACCESSTOKEN, "&link=", A1)), "")