Import Asana Data to Google Sheets
Asana is a project and task management tool. 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. We’ll first get a personal access token from Asana, and then set up a request to pull in data from Asana to your spreadsheet.
- Part 1: Get your Asana Personal Access Token
- Part 2: Create your API Request URL
- Part 3: Pull API Data into Sheets
- Part 4: Asana API Notes and Expansions
- 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 a Token. Copy this as we’ll need it shortly. Congrats! You now have access to Asana’s API.
We’re going to follow the Asana API documentation to first make a simple request with the /me endpoint.
- Base URL:https://app.asana.com/api/1.0
- Endpoint: /users/me
Putting it all together, we get the full API Request URL:
We can now enter all our values into API Connector to import Asana data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
- In the Create Request interface, enter the Request URL we just created
- Under Headers, enter Authorization as your Key, and Bearer YOUR_TOKEN as your Value, like this:
Authorization Bearer YOUR_TOKEN
Replace YOUR_TOKEN with the personal access token you got above in step 6.
- Create a new tab. You can call it whatever you like, but here we’ll call it ‘Asana User’. While still in that tab, click ‘Set’ to use that tab as your data destination.
- Name your request. Again we’ll call it ‘Asana User’
- Click Run and a moment later you’ll see details about your account populate the Asana User tab in your Google Sheet:
- Pay special attention to the field labeled
data » workspaces » gid. This is your workspace ID, which we can use to make further requests for tasks and project information.
- Experiment with different endpoints and query strings as described in the documentation. For example, to retrieve all your tasks, enter the following in the API Request field:
PROJECT_IDwith your project ID (run a request to the
/projectsendpoint or click on your project and check the URL bar to see this value).
- To create a new task in Asana from Google Sheets, make a POST request with this URL
As noted earlier, find your
PROJECT_IDvalue from the URL bar in the interface, and get your
WORKSPACE_IDfrom your initial
https://app.asana.com/api/1.0/users/merequest. 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.
- 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 the ‘limit’ and ‘offset’ parameters as described in the documentation, like this:
Note that the second request references the response token from the first request in order to populate the
offsetparameter. In API Connector, you can run these requests separately, or loop through them automatically using pagination handling (paid feature), like this:
Asana provides a full next page URL pre-populated with the required limit and offset parameters, so the pagination setup in the screenshot above demonstrates how to use ‘next page URL’ pagination.