You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

功能请求:ActiveCollab可筛选实时项目时间日志同步至Google Sheet

Alright, let's tackle your goal of syncing ActiveCollab's real-time time tracking data to Google Sheets and building a monthly project time overview. Here's a practical, step-by-step breakdown that balances code-based flexibility and no-code options depending on your team's comfort level:

Step 1: Get Access to ActiveCollab's API

To pull real-time time data, you'll need to use ActiveCollab's REST API. Here's how to get authenticated:

  • Log into your ActiveCollab account, go to My Profile > API Tokens
  • Click Generate New Token, give it a descriptive name (e.g., "Google Sheets Sync"), and save the token somewhere secure—you'll need it later.
Step 2: Fetch Time Tracking Data with a Script

A simple Python script is a great way to pull and format time entries. This example grabs all time entries (you can filter by project, date range, or user if needed):

import requests

# Replace these with your details
ACTIVECOLLAB_DOMAIN = "https://your-activecollab-instance.com"
API_TOKEN = "your-generated-api-token"
PROJECT_ID = "optional-project-id"  # Remove this param to get all projects

# Fetch time entries from ActiveCollab
response = requests.get(
    f"{ACTIVECOLLAB_DOMAIN}/api/v1/time-entries",
    headers={"Authorization": f"Bearer {API_TOKEN}"},
    params={"project_id": PROJECT_ID, "include": "user,project"}  # Pulls related user/project data
)

# Parse the response into usable data
time_entries = response.json()

This script returns entries with key details: date created, project name, user name, duration (in seconds), and entry description.

Step 3: Sync Data to Google Sheets

Once you have the data, you can push it to Google Sheets using the gspread library (a user-friendly wrapper for the Google Sheets API):

  1. First, set up Google Sheets API access:

    • Go to the Google Cloud Console, create a project, enable the Google Sheets API, and generate a service account key (save it as service-account-key.json).
    • Share your target Google Sheet with the service account's email (found in the key file).
  2. Install required packages:

    pip install gspread oauth2client
    
  3. Add this sync code to your script:

    import gspread
    from oauth2client.service_account import ServiceAccountCredentials
    
    # Authenticate with Google Sheets
    scope = ["https://spreadsheets.google.com/feeds", "https://www.googleapis.com/auth/drive"]
    creds = ServiceAccountCredentials.from_json_keyfile_name("service-account-key.json", scope)
    client = gspread.authorize(creds)
    
    # Open your spreadsheet and target worksheet
    sheet = client.open("Project Time Overview")
    raw_data_sheet = sheet.worksheet("Raw Time Entries")
    
    # Clear old data (optional, for fresh syncs)
    raw_data_sheet.clear()
    
    # Add header row
    headers = ["Date", "Project", "User", "Hours", "Description"]
    raw_data_sheet.append_row(headers)
    
    # Format and insert time entries
    for entry in time_entries:
        # Convert duration from seconds to hours
        hours = round(entry["duration"] / 3600, 2)
        row = [
            entry["created_on"],
            entry["project"]["name"],
            entry["user"]["name"],
            hours,
            entry["description"]
        ]
        raw_data_sheet.append_row(row)
    
Step 4: Build the Monthly Time Overview Table

Now turn the raw data into a actionable overview. Two easy methods:

Option 1: Pivot Table (No-Code)

  • Select the entire range of raw data in your sheet
  • Go to Data > Pivot table
    • Set Rows to Project
    • Set Columns to Date, then group by Month (right-click the date column in the pivot table > Create pivot date group > Month)
    • Set Values to Hours (summarize by SUM)
  • Format the pivot table to highlight totals and make it easy to scan.

Option 2: QUERY Function (Automated)

In a new worksheet, use this formula to generate a dynamic monthly breakdown:

=QUERY('Raw Time Entries'!A:E, "SELECT B, MONTH(A)+1, SUM(D) WHERE A IS NOT NULL GROUP BY B, MONTH(A)+1 LABEL MONTH(A)+1 'Month', SUM(D) 'Total Hours'", 1)

To convert month numbers to names, add a column with:

=TEXT(C2, "mmmm")
Step 5: Automate the Sync (For Real-Time Updates)

To keep your Sheet updated without running the script manually:

  • Code option: Deploy the Python script to a serverless platform like Google Cloud Functions or AWS Lambda, set a trigger to run hourly/daily.
  • No-code option: Use tools like Zapier or Make:
    • Create a zap with a trigger: ActiveCollab > New Time Entry
    • Add an action: Google Sheets > Append Row
    • Map the ActiveCollab fields (date, project, hours) to your Sheet columns.

With these steps, you'll have a live-updating overview that lets you easily track monthly time allocation across all your projects. Adjust the API filters or Sheets formulas to match your specific reporting needs!

内容的提问来源于stack exchange,提问作者Wes Maynard

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 03:43:33