Asana のタイムシートと予算アドオンを使用する組織では、正確な会計処理と給与計算のために定期的なレポート作成が不可欠です。Asana には充実したアプリ内ビューがありますが、外部監査やカスタム処理のために、月末や四半期末にドメイン全体のすべての時間入力を包括的に CSV エクスポートする必要がある場合があります。
この記事では、Asana API を使用してワークスペース全体の時間エントリを集計し、社内の要件に合った、会計処理に対応した整理された CSV にフォーマットする方法について説明します。
ノート
このガイドは、タイムシートと予算アドオンのユーザー向けに作成されていますが、この API ベースのエクスポート方法は、標準の Asana タスクフィールドを介して時間を記録するアドオンを使用していないユーザーも利用できます。
Asana の UI には強力なダッシュボードがありますが、API を介してエクスポートすると、次のことが可能になります。
標準的な会計慣行との互換性を確保するため、エクスポートスクリプトは、レビュアービューのエクスポートに表示される以下のフィールドを含む CSV を生成する必要があります。
列 | 説明 |
タスク名 | 時間が記録されたタスクのタイトル。 |
時間 (時間単位) | 合計所要時間 (分単位から 10 進数の時間単位に変換)。 |
日付 | 作業が実行された具体的な日付。 |
送信者 | 時間を記録したチームメンバーの名前。 |
タスク GID | Asana タスクの一意の識別子。 |
プロジェクト GID | 親プロジェクトの一意の識別子。 |
タスクステータス | タスクが現在「オープン」か「完了」か。 |
エントリ GID | 特定の時間ログの一意の識別子。 |
「すべて」の時間をエクスポートするには、スクリプトでプロジェクトを反復処理してタスクを見つけ、次に「タスクのタイムトラッキングの記録を取得」エンドポイントを使用してそれらのタスクのタイムトラッキングの記録を取得する必要があります。
Python
import asana
import pandas as pd# クライアントの初期化
client = asana.Client.access_token('YOUR_PERSONAL_ACCESS_TOKEN')workspace_gid = 'YOUR_WORKSPACE_GID'def export_domain_time():all_time_data = []
# 1. ワークスペース内のすべてのプロジェクトを反復処理するprojects = client.projects.get_projects({'workspace': workspace_gid})for project in projects:# 2. プロジェクトのすべてのタスクを取得するtasks = client.tasks.get_tasks_for_project(project['gid'], opt_fields=['name', 'gid', 'completed', 'completed_at', 'priority'])
for task in tasks:# 3. 各タスクの時間入力を取得するtime_entries = client.time_tracking_entries.get_time_tracking_entries_for_task(task['gid'],
opt_fields=['created_by.name', 'duration_minutes', 'entered_on', 'gid'])
for entry in time_entries:# 小数点形式で時間を計算するhours = round(entry['duration_minutes'] / 60, 2)# CSV テンプレートに合わせて行を構築するall_time_data.append({"タスク名": task['name'],"時間 (時間単位)": hours,"日付": entry['entered_on'],"送信者": entry['created_by']['name'],"タスク GID": task['gid'],"プロジェクト GID": project['gid'],"タスクのステータス": "完了" if task['completed'] else "オープン","タスク完了日": task.get('completed_at', ''),"タスクの優先度": task.get('priority', ''),"入力 GID": entry['gid']})
# 4. CSV として保存するdf = pd.DataFrame(all_time_data)df.to_csv('asana_time_export_accounting.csv', index=False)print("エクスポート完了: asana_time_export_accounting.csv")
export_domain_time()
組織全体に対してこのエクスポートを実行する場合は、次のベストプラクティスを念頭に置いてください。
ノート
この記事は AI によって翻訳されています。
翻訳に関するフィードバックを送る。

These cookies are strictly necessary to provide you with certain features. For example, these cookies allow you to access secure areas that require registration and set your privacy preferences. Because these cookies are essential to providing services to you, they cannot be disabled. You can set your browser to block or alert you about these cookies, but it may cause some parts of the site to not work.
Third party trackers collect information used for analytics and to personalize your experience with targeted ads. Under the Virginia Consumer Data Protection Act, you have the right to opt-out of the sale of your personal data to third parties. You also have the right to opt out of targeted advertising related processing. You may exercise your right to opt out of the sale of personal data and targeted advertising by using this toggle. If you opt out, we will not be able to offer you personalized ads and we will stop sharing your personal information with third parties. For more information please see our Privacy Statement.
These cookies allow us or our third-party analytics providers to collect information and statistics on use of our services by you and other visitors. This information helps us to improve our services and products for the benefit of you and others.
These cookies, provided by our third-party advertising partners, collect information about your browsing habits, as well as your preferences for various features and services. They also provide us with auditing, research, and reporting to know when advertising content has been displayed and how successful the content has been. This information allows us and our third-party advertising providers to display relevant advertising content.
These cookies provide enhanced functionality, providing chat support, allowing you to more easily complete forms, personalizing content to your preferences, and selecting your communications preferences. If you do not enable these cookies, or choose to disable them in the future, that could impact your ability to use certain features.