Get PayPal Access Token in Google Sheets

Get PayPal Access Token in Google Sheets

Paypal is probably the best-known online payments system, and, founded in the late '90s, certainly the longest-running. However their APIs are clunky and convoluted, especially in comparison to newer competitors like Stripe. This guide will help navigate the first step of getting started: retrieving the Paypal Access Token, which is required for making requests from their REST API. We'll pull it into Google Sheets, using the free API Connector add-on.


  1. Navigate to Paypal's Apps & Credentials page ( Click 'Log into Dashboard' if you aren't already logged into your account. You will need to sign up if you don't already have a developer account. paypal-img1

  2. Once you're logged in, you'll see a page containing a default application, with the option to create a new one. Click Create App to set up a new application. This will allow us to receive the credentials we need for querying the Paypal API.

  3. Give your app a name. It can be anything, but we'll call it 'Google Sheets'. Click Create App.

  4. You'll now see values for the Sandbox account email, the Client ID, and the Secret. Keep these handy as we'll need them in a minute.
  5. Note that we're using the Sandbox values for this demo. To access your actual account transactions, you can toggle the button at top from Sandbox to Live (some features available only for Business accounts).


  1. Paypal requires that we encode the above credentials to base 64, and then exchange them for an access token. To encode these credentials, open up Developer Tools in your browser (F12 on Windows/Linux or option + ⌘ + J on OSX). In the console, type in the following and click enter:

  2. You'll need to substitute in your own user credentials, like this (don't forget the colon in the middle):
    (If you have any problems with the above, you can also try a tool like Basic Authentication Header Generator to generate your header.) Copy the entire encoded string to your clipboard as we'll need it in a moment.

  3. Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
  4. In the Create Request interface, choose POST and enter the following values:
    • API URL path:
    • Headers: (Note that 'Basic {encoded value}' refers to the value retrieved just above in step 1)
      AuthorizationBasic {encoded value}
    • Post Body:

    All together, it will look like this:

  5. Create a new sheet. You can call it anything but we'll call it PaypalToken. Click Set to set this sheet to receive the output from your request.
  6. Name and save your request. Click Run and you'll see your Paypal access token printed onto your sheet.

    Congrats, you now have your Access Token!


    1. You can use your Paypal access token to make requests, but note that the 'expires_in' field contains the number of seconds until the token expires. In this case, it will last 9 hours, after which you will need to generate a new token. Unfortunately this prevents API Connector from accessing real-time refreshed Paypal data in Sheets.
    2. With that said, if you just want to pull Paypal data into Sheets at some infrequent interval, you can use the Access Token to do so, refreshing as needed. Enter your API URL into the API URL field, and enter the following headers, replacing {access token} with your Access Token:
      AuthorizationBearer {access token}

      This will produce a result as follows:

    3. Paypal doesn't provide any straightforward method to retrieve a list of all transactions. However, based on the documentation, the API URL to retrieve a list of completed payments made through the REST API is Please try it out and leave a comment if it works for you!


    Anyone with Owner or Edit access to your Google Sheet can view all the information you've saved within API Connector, including API keys and other credentials. Treat these keys as passwords and limit access to your sheet accordingly.


Leave a Reply

Your email address will not be published.