Skip to content

"Leave Approved — Calendar Updates Itself" — Google Apps Script Integration

The situation

After a leave request is approved, HR still has to manually update the Google Calendar or leave tracking spreadsheet — time-consuming and error-prone.

By connecting an API node to Google Apps Script, the moment a request is approved, Google Sheets automatically gets a new entry. HR doesn't have to do anything manually.

Workflow design

Employee submits leave request
(leave type, start date, end date, coverage person, reason)

Direct manager review

[Approved] → API Node: calls Google Apps Script
             → writes to leave tracking Google Sheet
             → Complete
[Rejected]  → Workflow ends

What to tell SuperAdmin Agent

"Create a leave request workflow. Employees fill in: leave type (Annual / Sick / Personal / Other), start date, end date, coverage person (select org member), and reason.

Submitted to the direct manager for review. When approved, call a Webhook URL (I'll fill it in later) to automatically write the leave data to our Google Sheet. If rejected, the workflow ends."

Setting up Google Apps Script

In your Google Sheet, create an Apps Script to receive data from kikuflow:

javascript
// Google Apps Script - doPost function
function doPost(e) {
  const data = JSON.parse(e.postData.contents);
  const sheet = SpreadsheetApp.getActiveSheet();

  // Write leave data to the spreadsheet
  sheet.appendRow([
    data.employeeName,   // Employee name
    data.leaveType,      // Leave type
    data.startDate,      // Start date
    data.endDate,        // End date
    data.proxy,          // Coverage person
    new Date()           // Record timestamp
  ]);

  return ContentService.createTextOutput('OK');
}
  1. In Apps Script, deploy as a "Web App" (Execute as: Me)
  2. Copy the deployment URL
  3. Paste it into the API node URL field in kikuflow

Data format sent by kikuflow

When an API node is triggered, kikuflow sends a POST request with the instance's form data:

json
{
  "instanceId": "...",
  "workflowName": "Leave Request",
  "submittedBy": "Employee Name",
  "fields": {
    "leaveType": "Annual",
    "startDate": "2025-03-10",
    "endDate": "2025-03-12",
    "proxy": "Bob Smith",
    "reason": "..."
  }
}

Further applications

The same approach can be extended to:

  • Automatically create an absence event in Google Calendar after approval
  • Auto-email the coverage person
  • Write to an HR system API

kikuflow User Manual