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. 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

  1. 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’
    api-connector-asana-img1
  2. From the My Profile Settings menu, click Apps
    api-connector-asana-img2
  3. Click Manage Developer Apps
    api-connector-asana-img3
  4. On the Developer Apps screen, click “+New Access Token”
    api-connector-asana-img4
  5. 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.
    api-connector-asana-img5
  6. You’ll now see a Token. Copy this as we’ll need it shortly. Congrats! You now have access to Asana’s API.
    api-connector-asana-img6

PART 2: CREATE YOUR API REQUEST URL

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:

https://app.asana.com/api/1.0/users/me

PART 3: PULL ASANA API DATA INTO SHEETS

We can now enter all our values into API Connector to import Asana data into Google Sheets.

  1. Open up Google Sheets and click Add-ons > API Connector > Open.
  2. In the Create tab, enter the Request URL we just created
    api-connector-asana-img7
  3. Under Headers, enter Authorization as your Key, and Bearer YOUR_TOKEN as your Value, like this:
    AuthorizationBearer YOUR_TOKEN

    Replace YOUR_TOKEN with the personal access token you got above in step 6.
    api-connector-asana-img8

  4. Create a new tab. Give it a name and click “Set current” to use that tab as your data destination.
  5. Name your request and click Run. A moment later you’ll see details about your account populate your sheet:
    api-connector-asana-img9
  6. 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.

PART 4: MORE EXAMPLE API URLS

  1. 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:
    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).

    api-connector-asana-img10
  2. To create a new task in Asana from Google Sheets, make a POST request with this URL
    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 your WORKSPACE_ID from your initial https://app.asana.com/api/1.0/users/me request. Input your task details into the POST body as described in the documentation, like this:

    api-connector-asana-img11

    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.
    api-connector-asana-img12

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 the ‘limit’ and ‘offset’ parameters as described in the documentation, like this:

page 1: https://app.asana.com/api/1.0/projects/PROJECT_ID/tasks?limit=100
page 2:  https://app.asana.com/api/1.0/projects/PROJECT_ID/tasks?limit=100&offset=+++Asana Tasks!D3+++

Note that the second request references the response token from the first request in order to populate the offset parameter. In API Connector, you can run these requests separately, or loop through them automatically using pagination handling (paid feature), like this:

api-connector-asana-img14

We could set up pagination with offset-limit parameters, but since Asana helpfully provides the full next page URL in the “uri” field, the pagination setup in the screenshot above demonstrates how to use ‘next page URL’ pagination.

2 thoughts on “Import Asana Data to Google Sheets”

  1. 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)

    Reply

Leave a Comment