Skip to main content

Automate weekly timesheet reporting with Salesforce, OpenAI and Gmail

Workflow preview

Workflow preview
100%
Automate weekly timesheet reporting with Salesforce, OpenAI and Gmail preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Weekly Timesheet Report + Pending Submissions Workflow Overview This workflow automates the entire weekly timesheet reporting cycle by integrating Salesforce, OpenAI, Gmail, and n8n. It retrieves e...

Best for

  • Document Extraction automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.salesforce, n8n-nodes-base.gmail, n8n-nodes-base.splitinbatches, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.merge, n8n-nodes-base.scheduletrigger, n8n-nodes-base.stickynote, n8n-nodes-base.code

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by DIGITAL BIZ TECH.

Original n8n.io source

1.1 Workflow description

Title
Automate weekly timesheet reporting with Salesforce, OpenAI and Gmail
Workflow name
Automate weekly timesheet reporting with Salesforce, OpenAI and Gmail

Weekly Timesheet Report + Pending Submissions Workflow

Overview

This workflow automates the entire weekly timesheet reporting cycle by integrating Salesforce, OpenAI, Gmail, and n8n. It retrieves employee timesheets for the previous week, identifies which were submitted or not, summarizes all line-item activities using OpenAI, and delivers a consolidated, manager-ready summary that mirrors the final email output.

The workflow eliminates manual checking, reduces repeated follow-ups, and ensures leadership receives an accurate, structured, and consistent weekly report.


Workflow Structure

Data Source: Salesforce DBT Timesheet App

This workflow requires the Digital Biz Tech – Simple Timesheet managed package to be installed in Salesforce.

Install the Timesheet App: https://appexchange.salesforce.com/appxListingDetail?listingId=a077704c-2e99-4653-8bde-d32e1fafd8c6

The workflow retrieves:

  • dbt__Timesheet__c — weekly timesheet records
  • dbt__Timesheet_Line_Item__c — project and activity entries
  • dbt__Employee__c — employee reference and metadata
  • Billable, non-billable, and absence hour details
  • Attendance information

These combined objects form the complete dataset used for both submitted and pending sections.

Trigger

Weekly n8n Schedule Trigger — runs once every week.

Submitted Path

Retrieve submitted timesheets → Fetch line items → Convert to HTML → OpenAI summary → Merge with employee details.

Pending Path

Identify “New” timesheets → Fetch employee details → Generate pending submission list.

Final Output

Merge both paths → Build formatted report → Gmail sends weekly email to managers.


Detailed Node-by-Node Explanation

1. Schedule Trigger

Runs weekly without manual intervention and targets the previous full week.

2. Timesheet – Salesforce GetAll

Fetches all dbt__Timesheet__c records matching: Timesheet for <week-start> to <week-end>

Extracted fields include:

  • Employee reference
  • Status
  • Billable, non-billable, absence hours
  • Total hours
  • Reporting period

Feeds both processing paths.


Processing Path A — Submitted Timesheets

3. Filter Submitted

Filters timesheets where dbt__Status__c == "Submitted".

4. Loop Through Each Submitted Record

Each employee’s timesheet is processed individually.

5. Retrieve Line Items

Fetches all dbt__Timesheet_Line_Item__c entries:

  • Project / Client
  • Activity
  • Duration
  • Work description
  • Billable category

6. Convert Line Items to HTML (Code Node)

Transforms line items into well-structured HTML tables for clean LLM input.

7. OpenAI — Weekly Activity Summary

OpenAI receives the HTML + Employee ID and returns a 4-point activity summary avoiding:

  • Hours
  • Dates
  • Repeated or irrelevant metadata

8. Fetch Employee Details

Retrieves employee name, email, and additional fields if needed.

9. Merge Employee + Summary

Combines:

  • Timesheet data
  • Employee details
  • OpenAI summary

Creates a unified object.

10. Prepare Submitted Section (Code Node)

Produces the formatted block used in the final email:

Employee: Name  
Period: Start → End  
Status: Submitted  
Total Hours: ...  

Timesheet Line Items Breakdown:
 - summary point  
 - summary point  
 - summary point  
 - summary point  

Processing Path B — Not Submitted Timesheets

11. Identify Not Submitted

Timesheets still in dbt__Status__c == "New" are flagged.

12. Retrieve Employee Information

Fetches employee name and email.

13. Merge Pending Information

Maps each missing submission with its reporting period.

14. Prepare Pending Reporting Block

Creates formatted pending entries:

TIMESHEET NOT SUBMITTED
Employee Name
Email: [email protected]

Final Assembly & Report Delivery

15. Merge Submitted + Pending Sections

Combines all processed data.

16. Create Final Email (Code Node)

Builds:

  • Subject
  • HTML body
  • Section headers
  • Manager recipient group

Matches the final email layout.

17. Send Email via Gmail

Automatically delivers the weekly summary to managers via Gmail OAuth.

No manual involvement required.


What Managers Receive Each Week

👤 Employee: Name
📅 Period: Start Date → End Date
📌 Status: Submitted
🕒 Total Hours: XX hrs
- Billable: XX hrs
- Non-Billable: XX hrs
- Absence: XX hrs
Weekly Requirement Met: ✔️ / ❌

📂 Timesheet Line Items Breakdown:
• Summary point 1
• Summary point 2
• Summary point 3
• Summary point 4
==========================================================
🟥 TIMESHEET NOT SUBMITTED 🟥
Employee Name
📧 Email: [email protected]

Data Flow Summary

Salesforce
 → Filter Submitted / Not Submitted
      ↳ Submitted → Line Items → HTML → OpenAI Summary → Merge
      ↳ Not Submitted → Employee Lookup → Merge
 → Code Node formats unified report
 → Gmail sends professional weekly summary

Technologies & Integrations

System Purpose Authentication
Salesforce Timesheets, Employees, Timesheet Line Items Salesforce OAuth
OpenAI Weekly activity summarization API Key
Gmail Automated email delivery Gmail OAuth
n8n Workflow automation & scheduling Native

Agent System Prompt Summary

> You are an AI assistant that extracts and summarizes weekly timesheet line items. Produce a clean, structured summary of work done for each employee. Focus only on project activities, tasks, accomplishments, and notable positives or negatives. Follow a strict JSON-only output format with four short points and no extra text or symbols.


Key Features

  • AI-driven extraction: Converts raw line items into clean weekly summaries.
  • Strict formatting: Always returns controlled 4-point JSON summaries.
  • Error-tolerant: Works even when timesheet entries are incomplete or messy.
  • Seamless integration: Works smoothly with Salesforce, n8n, Gmail, or OpenAI.

Setup Checklist

  1. Install DBT Timesheet App from Salesforce AppExchange
  2. Configure Salesforce OAuth
  3. Configure Gmail OAuth
  4. Set OpenAI model for summarization
  5. Update manager recipient list
  6. Activate the weekly schedule

Summary

This unified workflow delivers a complete, automated weekly reporting system that:

  • Eliminates manual timesheet checking
  • Identifies missing submissions instantly
  • Generates high-quality AI summaries
  • Improves visibility into employee productivity
  • Ensures accurate billable/non-billable tracking
  • Automates end-to-end weekly reporting

Need Help or More Workflows?

We can integrate this into your environment, tune the agent prompt, or extend it for more automation.

We can also help you set it up for free — from connecting credentials to deployment.

Contact: [email protected]
Website: https://www.digitalbiz.tech
LinkedIn: https://www.linkedin.com/company/digital-biz-tech/
You can also DM us on LinkedIn for any help.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Timesheet

Type / Role
n8n-nodes-base.salesforce - salesforce
Config choices
Version 1

Block 2 - Send a message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 3 - Salesforce - Get Employee Details

Type / Role
n8n-nodes-base.salesforce - salesforce
Config choices
Version 1

Block 4 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 5 - OpenAI1

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 6 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 7 - Salesforce - Get Employee Details1

Type / Role
n8n-nodes-base.salesforce - salesforce
Config choices
Version 1

Block 8 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 9 - Sticky Note12

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Get Timesheet Line Items

Type / Role
n8n-nodes-base.salesforce - salesforce
Config choices
Version 1

Block 12 - Generate HTML Table

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 13 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note9

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note15

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Merge AI Summary

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 17 - Prepare Submitted Section

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 18 - Merge Pending Info

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 19 - Merge Submitted + Pending

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 20 - Prepare Pending Section

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 21 - Create Final Email

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 22 - Sticky Note18

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - If New Timesheet

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 24 - If Submitted Timesheet

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

3. Summary Table

Workflow Automate weekly timesheet reporting with Salesforce, OpenAI and Gmail
Complexity advanced
Nodes 24
Categories Document Extraction, AI Summarization
Author DIGITAL BIZ TECH
Published 24 Nov 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/11191/11191.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automate weekly timesheet reporting with Salesforce, OpenAI and Gmail do?

Weekly Timesheet Report + Pending Submissions Workflow Overview This workflow automates the entire weekly timesheet reporting cycle by integrating Salesforce, OpenAI, Gmail, and n8n. It retrieves e...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI Summarization use case.