Python API - Direct .csv download

Good day everyone,
in order to analyze team-wide projects, I have been until now manually exporting .csv from the web visualization of Asana. With the goal of automating the task, I have started working on a custom Python script to download all tasks, sub-tasks and custom fields via API, trying to replicate the exact same format of the original .csv export. This has proven to be quite cumbersome with plenty of unexpected complications, and I was therefore wandering if a Python script could directly trigger a .csv export via URL (following the format[...]&domain=[...]) without prompting the email export.

Thanks in advance!

@Pietro_Lunati - welcome to the forum! Are you trying to do this for an individual project or your entire organization? Based on your first paragraph, it sounds like you want this for individual projects, but just want to make sure.

If it’s just one project, I do not believe you can initiate an export request. You would need to call the tasks API on the specific project (I think you’ll need to chain calls for each returned task to check for subtasks, but I haven’t tried this personally). NOTE: you’ll need to be comfortable transforming from JSON to CSV.

If you want the whole domain export, you will need to call the exports endpoint (EDIT: only available for service accounts of Enterprise+ subscribers). There are instructions in that link, but basically you make one call to request the export, then you poll every x minutes until the state changes. Then, you grab the URL and download the file from there (I think it’s also a JSON export).

One note: org exports are only available to Enterprise+ subscrptions.

1 Like

Thanks for the clear and detailed answer @Stephen_Li! Unfortunately the inability to access to a complete domain export will force me to endure with an ad-hoc Python script to manually create a .csv. On a brighter note, the work I have done till now will not go wasted!

Thanks to @Phil_Seeman as well for the clarification!

1 Like