API Connector Documentation
Import Asana Data to Google Sheets
In this guide, we’ll walk through how to pull tasks from the Asana API directly into Google Sheets, using the API Connector add-on for Sheets.
There are 2 ways to connect to the Asana API:
- Preset "Connect" button (OAuth)
- Personal access token. Please check the appendix for detailed instructions to retrieve your token.
Contents
- Before You Begin
- Part 1: Connect to the Asana API
- Part 2: Pull Data from Asana to Sheets
- Part 3: Create a Custom Request
- Part 4: More Example API URLs
- Part 5: Handle Pagination
- Part 6: API Documentation
- Appendix: Connect with an Asana Personal Access Token
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Connect to the Asana API
The easiest way to get started with the Asana API is through API Connector's built-in integration.
- In Sheets, open API Connector and create a new request (Extensions > API Connector > Open > Create request)
- Select Asana from the drop-down list of applications
- Under Authorization, click Connect to Asana
- You be asked to authorize the connection. Click Allow.
- You’ll then be returned to your Google Sheet, and can verify that your Asana connection is now active.
Part 2: Pull Data from Asana to Sheets
Now that we’re connected, let’s pull some data into Sheets.
- Under Endpoint, choose Get your workspaces. This will return your workspace ID(s), which you'll need for subsequent requests.
- There are no other required parameters for this endpoint, so just select a destination sheet, name your request, and click Run. You'll see your workspace ID returned in the data.gid field.
- You can now plug this value into other requests. For example, the /projects endpoint can accept a workspace ID as a filter.
Part 3: 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 API URLs shown in the API documentation. To create a custom request, add your complete URL into the Request URL field, and choose Asana from the OAuth menu (or connect with a token). Here's an example request setup:
- Application:
Custom
- Method:
GET
- Request URL:
https://app.asana.com/api/1.0/users/me
- OAuth:
Asana
Part 4: More Example API URLs
Here are some more examples of custom API URLs. Check the documentation for the full list of possible requests.
- Retrieve all your tasks
https://app.asana.com/api/1.0/projects/PROJECT_ID/tasks
Replace
PROJECT_ID
with your project ID (run a request to the/projects
endpoint or click on your project and check the URL bar to see this value).
- Create a new task
POST https://app.asana.com/api/1.0/tasks?projects=PROJECT_ID&workspace=WORKSPACE_ID
As noted earlier, find your
PROJECT_ID
value from the URL bar in the interface, and get yourWORKSPACE_ID
from your initialhttps://app.asana.com/api/1.0/users/me
request. Input your task details into the POST body as described in the documentation, like this:You will immediately see your new task reflected in your Asana dashboard. Note that you can only create one task at a time with this method.
Part 5: Handle Pagination
Asana recommends using pagination when retrieving large result sets, to break responses into smaller sets. If your response set is too large, you may receive an error like this: "The result is too large. You should use pagination (may require specifying a workspace)!" To resolve this issue, paginate your response by using limit
and offset
parameters.
In API Connector, you can cycle through these paginated requests automatically using pagination handling, like this:
- Pagination type:
next page URL
- Next page path:
next_page.uri
- Run until: choose when the request should stop running
Part 6: API Documentation
Official API documentation: https://developers.asana.com/docs
Appendix: Connect with an Asana Personal Access Token
This method is an alternative to the method described above. Instead of clicking Connect, retrieve your own personal token.
- Log in to Asana and click your profile icon in the top right corner to open the profile drop-down menu. Click 'My Profile Settings'
- From the My Profile Settings menu, click Apps
- Click Manage Developer Apps
- On the Developer Apps screen, click "+New Access Token"
- A screen will open, prompting you to provide a name. You can name it whatever you like, but here we'll name it Google Sheets. Check the terms and conditions box, and click Create Token.
- You'll now see your Token. Congrats! Copy it to your clipboard.
- To use this token, under Headers, enter Authorization as your Key, and Bearer YOUR_TOKEN as your Value, like this:
- Your requests should run as described in the Custom requests section. Select OAuth = None as you're connecting with a token instead.
can we use this API method to pull data from asana to google sheet? specifically to pull all the tasks (both not completed and completed for all members in the asana)
Yes, please check https://developers.asana.com/docs/#asana-tasks for all the API calls you can make involving tasks. This guide also walks through how to pull task info in the first bullet under Part 4.
This was SO helpful and I really appreciate the walkthrough. Thank you for providing this!
Awesome, I'm glad to hear that!
We’re looking for an integration for Asana that would assist us with the two following points:
• Ability to extract a list of our Projects from within our Teams in Asana into a printable format/CSV/Google Sheets, etc.
• Track the history of changes in a custom field, with date stamps, within our Portfolios
Would this be something your integration would have the capability of?
To get a list of projects, you should be able to select API Connector's preset Asana integration and the
/projects
endpoint. However, API Connector doesn't have any built-in functionality itself for tracking changes; it's just a pipeline from Asanas's API into Google Sheets. That means you can access data from any of the endpoints listed here: https://developers.asana.com/reference/ac-api-reference. I'm not sure if any of those correspond to tracking change history, but maybe the "get status updates" endpoint would be useful here? https://developers.asana.com/reference/getstatusesforobjectHi Ana, is it possible to pull the task URL as part of the 'tasks' endpoint?
I basically want to be able to pull the task title and URL for every task in a certain project.
Sure, if you're using the preset integration fill in the "opt_fields" parameter with
name,permalink_url
, or if you're running a custom request enter it like this:https://app.asana.com/api/1.0/projects/1111111111/tasks??opt_fields=name,permalink_url
.permalink_url
will return the URL. You can see the full list of available fields here: https://developers.asana.com/reference/tasks#task