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_gid})プロジェクトのプロジェクトの場合:# 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:# 10 進数形式で時間を計算するhours = round(entry['duration_minutes'] / 60, 2)# CSV テンプレートに合わせて行を作成するall_time_data.append({"タスク名": task['name'],"Time (hours)": hours,"日付": entry['entered_on'],"送信者": entry['created_by']['name'],"タスクGID": task['gid'],"プロジェクトGID": project['gid'],"Task Status": "Completed" if task['completed'] else "Open","Task Completion Date": task.get('completed_at', ''),"タスクの優先度": task.get('priority', ''),"Entry 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.