How to connect the Pesatime API to Google Sheets

Pesatime is an easy to use online accounting software. We can use the Pesatime API to import data from Pesatime into Google Sheets. In this tutorial, we’ll show you how to connect the Pesatime REST API to Google Sheets in 5 steps:

  1. Install the Apipheny add-on
  2. Obtain the authentication headers
  3. Choose a Pesatime API endpoint
  4. Enter the Pesatime API request into the Apipheny add-on
  5. Run the Pesatime API request in your Google Sheet

Step 1.) Install and open the Apipheny add-on for Google Sheets

Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.

1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install

2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.

In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new

Step 2.) Obtain the authentication headers

After logging into your Pesatime account, go to </> Developer to find your secret keys:

API keys section
API keys section

Copy and paste your keys to a safe location because you’ll need them later.

Step 3.) Choose a Pesatime endpoint

In this section, we’ll show you how to browse the Pesatime API documentation to find an API endpoint that retrieves the specific information you need from your Pesatime account. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.

First, open the Pesatime API documentation page: https://developer.pesatime.com/

The menu on the left contains general topics about the Pesatime API and two endpoint groups, Expenses and Income:

Pesatime documentation page
Pesatime documentation page

In this case, we will describe the Retrieve – All Income endpoint, which retrieves all sales made. The URL for this endpoint is:

https://api.pesatime.com/v1/income

The documentation for this endpoint contains its HTTP method and URL path, a short description of the endpoint’s purpose, the accepted path parameters, and the responses it can return:

Income- Retrieve - All endpoint
Income- Retrieve – All endpoint

All API calls to the Pesatime API should be made with the https://api.pesatime.com/v1/ base domain. All endpoints should be appended to this base domain.

Step 4.) Enter the Pesatime API request into Apipheny

Okay, we’re in the home stretch. Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import Tab open, enter these details into the add-on:

Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) as required by your Pesatime API endpoint. For this example, we are using the GET method.

API URL: In Step 3, we explained how you can find the Pesatime API endpoint that you need. Now copy the complete API URL into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query.

For this example, we are using the Expenses endpoint, which retrieves all expenses. The corresponding URL for this endpoint is:

https://api.pesatime.com/v1/expenses

We can add a date_from=2021-09-14 parameter at the end of the URL to obtain expenses from that specific day. So the URL then becomes:

https://api.pesatime.com/v1/expenses?date_from=2021-09-14

In the Headers of the Apipheny add-on section, add three rows with the following keys and values:

Header 1
Key:
x-rest-api-key
Value:
API_KEY

Header 2
Key:
x-rest-user
Value:
DEV_USER_ID

Header 3
Key:
x-rest-api-secret
Value:
API_SECRET

Don’t forget to replace the API_KEY, the DEV_USER_ID, and the API_SECRET values with the values you previously obtained in Step 2.

Here’s what our request looks like when entered into Apipheny:

Pesatime API request entered into Apipheny
Pesatime API request entered into Apipheny

Step 5.) Run the Pesatime API request in your Google Sheet

The last step is to click the Run button at the bottom of the Apipheny add-on and then your Pesatime data will be imported into your Google Sheet:

Pesatime data imported into Google Sheets
Pesatime data imported into Google Sheets

After making a successful request to the Pesatime API, try querying a different Pesatime API endpoint, or try using one of the more advanced features in the Apipheny add-on.


Crypto API tutorials and more:


API Tutorials



API Knowledge

What is an API?
What is an API URL?
What are parameters?
What is an endpoint?
What is an API key/token?
What is basic authentication?
What are headers?
What is a GET request?
What is a POST request?