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:
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.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
After logging into your Square account, go to the Developer Dashboard:
Then click the +Create your first application button:
Complete the Application Name field, check the Terms and Conditions checkbox, and then click the Save button:
Your app is now created:
Next, click the Open button in your newly created app:
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:
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
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:
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:
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:
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-08-23 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.
⚠️ Note: Square-Version has been updated to 2022-08-23. Always check the docs for the latest version.
Here’s what your API request should look like in Apipheny, if you’re following the same example as us:
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:
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:
Crypto API Tutorials: