How to POST a request from Google Sheets to an API

Step 1: Install Apipheny

Apipheny is a Google Sheets API add-on that makes it easy to make GET and POST API requests from Google Sheets.

You can install the add-on in Google’s G Suite Marketplace:

Watch our demo video to learn how to use Apipheny to make a POST request:

Step 2: Enter your API URL and POST body in the Apipheny add-on, then click “Run”

To make a POST request from Google Sheets using the Apipheny add-on, simply open the add-on after installing it, then follow these steps:
1.) Choose the “POST” method in the Import tab of the add-on

2.) Enter your API URL in the dedicated field

3.) Enter your POST body in the dedicated field

4.) Click “Run” and your Google Sheets will POST the request

That’s it! Making a Google Sheets POST Request really is that easy using the Apipheny add-on.

Any data that is returned by the POST request will be returned to the Sheet that is open when you make a request.

If you want to have the data returned to a specific sheet, first enter your API details in the Import tab, and then click the Save button at the bottom of the add-on. Then go to the “Manage” tab and open the saved POST request and edit the name of the sheet that the request is connected to.

Optional: Make a dynamic POST request using variables in the POST Body

Using variables, a cell can be referenced in the request. Then, data can be POSTed on a schedule or the function can be called.

You can reference cells on the spreadsheet in any of the add-on’s form fields (API URL, Headers, or POST Body) by wrapping them within 3 curly braces. E.g. {{{Sheet1!A1}}}

Let’s use a CRM as an example. In your CRM you could have a tab for a specific customer you update frequently.

For example, let’s assume “customer id” is in B1, customer name is in A1, and customer email is in A2)

POST Body:
name: {{{Sheet1!A1}}},
email: {{{Sheet1!A2}}}

If you schedule this request to fire every hour, it would pull the data from the sheet every hour and send it to the server, triggering the CRM to update based on data in the sheet.

Where this gets slightly complicated, is you’ll want to avoid the response overwriting your sheets contents. So although you’ll reference cells on Sheet1, you’ll want to push the output to Sheet2 by changing the “Sheet” field in the saved request to say “Sheet2”.

Related Articles:

Related Posts

Leave a Comment