Portfolio to CSV export

The Portfolio to CSV Export script is used to extract project metadata from a nested portfolio structure in Asana. The resulting data, retrieved from requests to Asana's API, is formatted and exported in CSV format.

📘

Open source example

You can access this open source example script here in the devrel-examples repository. Feel free to follow the comments in the ./index.js file as you inspect the script's business logic.


Example use case

Reporting allows you to translate and review data in an organized, easily digestible format. With the Portfolio to CSV Export script, you can create basic ad hoc reports without the use of other data visualization software.

Since portfolios can contain both individual projects and other portfolios themselves, this script allows users to extract all project metadata from even deeply-nested portfolio structures, and collect information on these projects into a single CSV file.

Along with general project or program status reporting, you may use this script as a starting point for creating more complex data reports, such as task-level reporting or even direct integration into your reporting tool of choice.


API endpoints

As a reference, the portfolio to CSV export script leverages the following API endpoints:

HTTP methodURLDescription
GET/users/{user_gid}Get a user
GET/portfolios/{portfolio_gid}/itemsGet portfolio items

Additionally, the script also makes use of opt fields and paginated requests.


Getting started

Requirements

Since the script largely makes use of out-of-the-box DOM methods in the browser, there are no system requirements for this script.

Otherwise, ensure that you have the latest version of your preferred browser installed on your local machine.

Usage

The entry point for the script is ./index.html, a page that embeds the client-side script ./index.js and its helper/utility methods in ./utils.js.

Before you begin, be sure to obtain a personal access token (PAT). This personal access token is how the script authenticates with Asana to request data via the Asana API. Upon successful authentication, the script parses and formats that data into a single CSV file.

Then, to get started, open ./index.html in your browser and provide your personal access token and a portfolio GID in the input fields. Additional operating instructions are included on the page itself.

Output

The standard information outputted in the resulting CSV file include the following project metadata:

  • gid
  • name
  • notes
  • color
  • created_at
  • archived
  • current_status_update
  • modified_at
  • owner
  • public
  • start_on
  • due_on

In addition, the CSV file will also include details on any custom fields associated with those projects.

🚧

Complete data access

The accuracy of the portfolio to CSV export script is limited by the portfolios and projects that the authenticated user (i.e., through the personal access token) has access to.

For a complete representation of the data in a portfolio, use a Service Account to perform such audits.

To get more information on a project, you can request the project record by using its GID with the Asana API, as documented here: GET /projects/{project_gid}. Project schemas can also be found here in the API reference.