Search API Connector Documentation
Import Stripe Data to Google Sheets
In this guide, we’ll walk through how to pull transactions from the Stripe API directly into Google Sheets, using the API Connector add-on for Google Sheets. Stripe is of course a popular payment processor known for its fantastic APIs.
There are 2 ways to connect to the Stripe API:
- Preset “Connect” button (OAuth) premium
- Personal API key. Please check the appendix for detailed instructions to retrieve your key.
- Before You Begin
- Part 1: Connect to the Stripe API
- Part 2: Create your API Request URL
- Part 3: Pull Stripe API Data into Sheets
- Part 4: Fetch and Append New Data
- Part 5: Get More Data
- Part 6: Handle Pagination
- Part 7: API Documentation
- Appendix: Connect with a Stripe API Key
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Connect to the Stripe API
If you haven’t connected API Connector to Stripe before, you’ll first need to initiate the connection as follows:
- Open up Google Sheets and click Extensions > API Connector > Manage Connections.
- In the list of available connections, find Stripe and click Connect.
- You’ll be asked to authorize the connection. Click Connect.
- Once you connect the account, you’ll be returned to your Google Sheet and can verify that the connection is active on the Connections screen.
Part 2: Create Your Stripe API Request URL
We’ll first follow the Stripe API documentation to request a list of transactions.
- Base URL: https://api.stripe.com/v1
- Endpoint: /charges
- Parameters: ?limit=100
The ‘limit’ parameter is optional but we’ll include it to show how parameters work. Putting it all together, we get the full API Request URL:
Part 3: Pull Stripe API Data into Sheets
Now let’s grab that Stripe data!
- Open up Google Sheets and click Extensions > API Connector > Open.
- In the Create screen, enter the Request URL we just created
- Under OAuth, choose Stripe
- We don’t need any headers so just leave that section blank.
- Create a new tab and click Set current to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see your charges data populate your Google Sheet:
Part 4: Fetch and Append New Data
Rather than retrieving the entire data set each time you run your request, you can set your request to fetch new data only. There are a few approaches you could take; here’s one:
- Run an initial request like
- Use the field editor to select just the fields you want and assign them to specific columns in your report.
- Create a new sheet called Inputs that contains this function:
=max(Charges!F:F). That will grab the most recent date from the API response (change F:F to whichever column holds your create date)
- Switch your request to Append mode and use that maximum date in your request URL like this:
created[gt]means ‘created greater than’, so this will ensure that each request only retrieves new data, and append mode will add that new data to the end of your existing dataset.
- Set your request to run on a schedule. You won’t need to update your request again.
Part 5: More Example API URLs
You can check the documentation for the full list of available API requests, but if you just want to jump in, you can play around with the URLs you enter in the API URL path field. Try the following (one at a time):
Part 6: Handle Pagination
- By default, Stripe will only return 10 records at a time. To retrieve more, use the ‘limit’ and ‘starting_after’ parameters as described in their documentation.
- You can run these request URLs manually, or loop through them automatically using pagination handling (paid feature), like this:
- API URL: enter your request URL, including limit=100
- Pagination type:
- Next token parameter:
- Next token path:
- Run until: choose when to stop fetching data
Part 7: API Documentation
Official API documentation: https://stripe.com/docs/api
Appendix: Connect with a Stripe API Key
- As a free alternative to connecting via OAuth, you can connect with your own API key. Log in to Stripe and click Developers > API keys from the left-hand menu
- On this page, you’ll see that API keys have already been automatically created for you. You can choose between test data and real data; they work exactly the same way. (If you want to use live data, simply toggle the ‘Viewing Test Data’ option). Click to reveal the secret token:
- Once you have your key, use it by entering a key-value pair in the Headers section, where Key = Authorization, Value = Bearer YOUR_SECRET_TOKEN. Since you’re connecting with an API key, leave OAuth set to None.