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.
We'll first get an API key from Stripe, and then set up a request to pull in Stripe API data to your spreadsheet.
- Before You Begin
- Part 1: Get your Stripe API Key
- Part 2: Pull Data from Stripe to Sheets
- Part 3: Fetch and Append New Charges
- Part 4: Create a Custom API Request
- Part 5: Handle Pagination
- Part 6: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get your Stripe API Key
- Log in to Stripe and click Developers > API keys
- On this page, you'll see that API keys have already been automatically created for you. While you can use these, for added security let's create a restricted key. Click Create restricted key.
- Here you'll be prompted to choose which data points your key should have access to. Most likely you'll want read access to Charges, but you may also want to add access to Balance, Customers, Products, Subscriptions, and so on. Just select what you think you need; you can always change this later.
- Once you've selected your permissions, scroll down and click Create key. Your new key will appear; copy it as you'll need it soon!
Note: When you use this key, enter it with the word
Bearerin front, e.g.
Part 2: Pull Data from Stripe to Sheets
The easiest way to get started with the Stripe API is through API Connector’s built-in integration.
- Select Stripe from the drop-down list of applications
- Under Authorization, enter your new API key with the word
Bearerin front of it.
- Under Endpoint, choose
/chargesto get a list of charges for your account.
- Optionally set the
createdor other parameters to filter by date or other measures. Pay attention to the limit parameter as Stripe will only send 10 records by default.
- Select a destination sheet, name your request, and click Run.
Part 3: Fetch and Append New Charges
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:
- Create an initial request to the
/chargesendpoint. Use the field editor to select just the fields you want and assign them to specific columns in your report.
- Run the request, sending the response to a sheet called Charges.
- Now in a second sheet, get the maximum (i.e. most recent) timestamp from the response data with a formula like
. That will grab the most recent date from the API response (change
F:Fto whichever column holds your create date)
- Update your request to reference this cell in the
parameter of your request.
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 4: Create a Custom Request
Alternatively, you can run your own custom requests instead of using API Connector’s pre-built integration, using any of the endpoints and parameters shown in the API documentation. Here's an example request setup, just substitute in your own secret key:
- Request URL:
Part 5: Handle Pagination
- By default, Stripe will only return 10 records at a time. To retrieve more, use the
starting_afterparameters as described in their documentation.
- You can run these request URLs manually, or loop through them automatically using pagination handling (paid feature), like this:
- Pagination type:
- Next token parameter:
- Next token path:
- Run until: choose when to stop fetching data
- Pagination type:
Part 6: API Documentation
Official API documentation: https://stripe.com/docs/api