This script automates the process of backing up tasks, comments, and attachments from an Asana project. It takes task details and histories and saves them in a CSV file, with attachments in structured folders. Users can specify their Asana access token, project ID, and the output directory.
- Fetch tasks from an Asana project
- Retrieve task details, comments (stories), and attachments
- Download attachments and save them with unique filenames
- Save all task data to a CSV file
- Python 3.6+
requests
library
-
Clone the repository:
git clone https://github.com/yourusername/AsanaBackupTool.git cd AsanaBackupTool
-
Install the required libraries:
pip install requests
Run the script with the required Asana access token, project ID, and optional output directory:
python Asana_backup.py --help
usage: Asana_backup.py [-h] --token TOKEN --project-id PROJECT_ID [--output-dir OUTPUT_DIR] [--without-attachments]
Asana Backup Script
options:
-h, --help show this help message and exit
--token TOKEN (Required) Your Asana Access Token
--project-id PROJECT_ID
(Required) ID of the Asana project to back up
--output-dir OUTPUT_DIR
(Optional) Directory where the output will be saved. Default is `asana_project_data`
--without-attachments
(Optional) Do not download attachments
The script creates a directory (default asana_project_data) containing:
- A CSV file (project_data.csv) with task details.
- The attachments folder containing all files in their respective task folders, saved with unique file names.
To integrate with Asana's API, you'll need to obtain your Project ID and an Access Token. Follow the steps below to retrieve these details.
- Navigate to the project for which you want the ID.
- Look at the URL in your browser's address bar. It should look something like this:
https://app.asana.com/0/{workspace_id}/{project_id}
- Copy your project_id
- Go to the Asana Developer Console:
- Navigate to Asana Developer Console.
- Create a new Personal Access Token:
- Click on "Create new token".
- Give your token a name, for example "My Project Integration".
- Click "Create Token".
- Copy your Personal Access Token:
- Once the token is generated, copy it immediately. You won’t be able to see it again.
- Store it in a secure place.
Feel free to open issues or submit pull requests for any improvements or bug fixes.
This project is licensed under the MIT License.