Square provides financial solutions for businesses. We can use Square’s API to extract and import data into Google Sheets. In this tutorial, you will learn how to connect the Square API to Google Sheets in 6 steps:

  1. Install the Apipheny Add-on
  2. Create a Square API App
  3. Obtain Credentials
  4. Choose an Endpoint URL
  5. Enter the Square API request into Apipheny
  6. Run the Square 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.) Create a Square API app

After logging into your Square account, go to the Developer Dashboard:

Log in to your Square account and then go to the developer dashboard
Log in to your Square account and then go to the developer dashboard

Then click the +Create your first application button:

Click the button to create your first application
Click the button to create your first application

Complete the Application Name field, check the Terms and Conditions checkbox, and then click the Save button:

Enter a name, agree to the terms of service, and click Save
Enter a name, agree to the terms of service, and click Save

Your app is now created:

You've successfully created a Square API app
You’ve successfully created a Square API app

Step 3.) Obtain Credentials

Next, click the Open button in your newly created app:

Click "Open"
Click “Open”

In the menu on the left, click the OAuth item, then at the top of this page, choose Sandbox. Complete the Sandbox Redirect URL (enter any URL) and then click the Save button:

Enter a URL and click Save
Enter a URL and click Save

In the Credentials section, you’ll find the Sandbox Access Token. Click the Show link to reveal the value of the token and then copy and paste the value of the API key in a safe location, because you’ll need it in the next steps

Copy and paste your Access Token in a safe location for use in the next steps
Copy and paste your Access Token in a safe location for use in the next steps

Step 4.) Choose your Endpoint URL

In this section, we’ll show you how to browse the Square API documentation to find an API URL, endpoint, and parameters that retrieves the information you need from your Square account.

If you already know your URL and endpoint, or if you want to use the same example URL as us, just skip to Step 5.

First, open the Square API documentation page: https://developer.squareup.com/reference/square

The menu on the left contains a list of categories, each with its own endpoints:

Square API documentation
Square API documentation

If you click on a category (eg. Orders), a list with specific endpoints will be expanded in the main section of the page, along with a short description of that category:

Example Square API endpoint
Example Square API endpoint

An example endpoint is Create order, which creates a new Order that can include information on products for purchase and settings to apply to that purchase. The URL for that endpoint is:

https://connect.squareup.com/v2/orders

Each endpoint’s documentation contains its HTTP method (POST), its request URI, a short description of its purpose, the list of required permissions and the list of request body parameters.

On a black section on the right, you will find the cURL command, the headers and an example response:

Step 5.) Enter the Square API request into Apipheny

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) required by your API endpoint. For this example, we are using the GET method.

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

For this example, we are using the List merchants endpoint, which returns Merchant information for a given access token. The corresponding URL for this endpoint is:

https://connect.squareupsandbox.com/v2/merchants

If you’re following the same example, just copy and paste this URL into Apipheny, where it says API URL.

Headers: In the Headers section of Apipheny, add two rows with the following key and value:

Header 1
Key:
Square-Version
Value:
2022-01-20

Header 2
Key:
Authorization
Value:
Bearer your_token

Make sure to replace your_token with the value of the token you obtained previously, in Step 3. There should be a space between Bearer and your_token.

Here’s what your API request should look like in Apipheny, if you’re following the same example as us:

Square API request entered in the Apipheny add-on
Square API request entered in the Apipheny add-on

Step 6.) Run the Square API request

Lastly, click the Run button at the bottom of the Apipheny add-on and then wait for the Square API data to be retrieved and added to your Google spreadsheet:

Square API data imported into Google Sheets using Apipheny
Square API data imported into Google Sheets using Apipheny

That’s it! You’ve successfully connected your Square account to Google Sheets using the Square API, Google Sheets API, and the Apipheny add-on.

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

  • Save and schedule your Square API request
  • Make a POST request to the Square API (if available)
  • Use the custom =APIPHENY() function to call the Square API request inside your spreadsheet
  • Create an API request by referencing the value of a cell in your Square API URL with three curly braces eg. {{{Sheet1!A1}}}

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?