{
  "name": "VCL_Attendance_Report_Google_Sheets",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "value": "1w8H1dpUkukmG0ZfnWdx-p6m7bzzoE2Lc",
          "mode": "list",
          "cachedResultName": "VCL-Attendance",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1w8H1dpUkukmG0ZfnWdx-p6m7bzzoE2Lc"
        },
        "event": "fileCreated",
        "options": {
          "fileType": "all"
        }
      },
      "type": "n8n-nodes-base.googleDriveTrigger",
      "typeVersion": 1,
      "position": [
        -1808,
        -816
      ],
      "id": "4505659f-0b61-482c-b087-dd889a2777c8",
      "name": "Google Drive Trigger",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -1584,
        -816
      ],
      "id": "c0e94283-ab1b-4061-99b6-af0607a9c97d",
      "name": "Download file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "xls",
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        -1360,
        -720
      ],
      "id": "df3478df-a5c5-4628-8a82-69b5fec7890f",
      "name": "Extract from File"
    },
    {
      "parameters": {
        "text": "=Date {{ $json.Date }}\nID {{ $json.ID }}\nName {{ $json.Name }}\nTime {{ $json.Time }}\nRemark {{ $json.Remark }}\nDepartment {{ $json.Department }}",
        "attributes": {
          "attributes": [
            {
              "name": "date",
              "description": "date",
              "required": true
            },
            {
              "name": "employee_id",
              "description": "employee id",
              "required": true
            },
            {
              "name": "name",
              "description": "name",
              "required": true
            },
            {
              "name": "time",
              "description": "time",
              "required": true
            },
            {
              "name": "=remark",
              "description": "=remark",
              "required": true
            },
            {
              "name": "status",
              "description": "status",
              "required": true
            },
            {
              "name": "department",
              "description": "demartment",
              "required": true
            }
          ]
        },
        "options": {
          "systemPromptTemplate": "=You are an expert extraction algorithm.\nOnly extract relevant information from the text.\nIf you do not know the value of an attribute asked to extract, you may omit the attribute's value.\n\nEach employee should have a date, employee_id, name, time, remark, department, status.\n\n# If time is after 9:35am then, status should be \"Late\" otherwise \"On-Time\". And if any considerable Remark found e.g: visit factory, reached ontime or forget to sign in and mentioned time on the remark before 9:35am only then status should be \"On-Time\"."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "typeVersion": 1.2,
      "position": [
        -1136,
        -720
      ],
      "id": "1edec101-6214-482e-901d-da4899eee7c1",
      "name": "Information Extractor",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "1c038a36-74b5-4670-b169-46c2f2fda641",
              "name": "Date",
              "value": "={{ $json.output.date }}",
              "type": "string"
            },
            {
              "id": "d08351f0-9775-420f-9e14-ee80a403c35c",
              "name": "Employee_ID",
              "value": "={{ $json.output.employee_id }}",
              "type": "string"
            },
            {
              "id": "55284bf4-6d0a-4c26-a6b7-ced2d874d859",
              "name": "Name",
              "value": "={{ $json.output.name }}",
              "type": "string"
            },
            {
              "id": "1077b9ad-b058-4efe-9f85-ecc39f632a43",
              "name": "Time",
              "value": "={{ $json.output.time }}",
              "type": "string"
            },
            {
              "id": "2f17cf33-e4d4-4853-832b-05db1d183a3d",
              "name": "Remark",
              "value": "={{ $json.output.remark }}",
              "type": "string"
            },
            {
              "id": "ab02049f-bba1-4a64-9f05-265b40f2278d",
              "name": "Status",
              "value": "={{ $json.output.status }}",
              "type": "string"
            },
            {
              "id": "ced8c4c6-937c-4e87-8b96-965f62e80eb0",
              "name": "Department",
              "value": "={{ $json.output.department }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -784,
        -720
      ],
      "id": "3dd0745d-ac53-46a4-8a8b-b88eba77cc58",
      "name": "Edit Fields1"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -1072,
        -496
      ],
      "id": "2a77d847-89d7-4f97-86d4-3cde3a6685b0",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1_Lxj4ylJ0DjUSTrqZrS0AmA_T8UEzSU5NgStipAlPUI",
          "mode": "list",
          "cachedResultName": "VCL-Attendance-Report-2025",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_Lxj4ylJ0DjUSTrqZrS0AmA_T8UEzSU5NgStipAlPUI/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "={{ String($('Download file').item.json.originalFilename.split('.').slice(0, -1).join('.')) }}",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": [
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Employee_ID",
              "displayName": "Employee_ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Time",
              "displayName": "Time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "remark",
              "displayName": "remark",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Department",
              "displayName": "Department",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "cellFormat": "USER_ENTERED"
        }
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -560,
        -720
      ],
      "id": "58531a14-775e-4861-ac76-bd4d992bc41e",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "create",
        "documentId": {
          "__rl": true,
          "value": "1_Lxj4ylJ0DjUSTrqZrS0AmA_T8UEzSU5NgStipAlPUI",
          "mode": "list",
          "cachedResultName": "VCL-Attendance-Report-2025",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_Lxj4ylJ0DjUSTrqZrS0AmA_T8UEzSU5NgStipAlPUI/edit?usp=drivesdk"
        },
        "title": "={{ String($('Download file').item.json.originalFilename.split('.').slice(0, -1).join('.')) }}",
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -1360,
        -912
      ],
      "id": "8ad957fd-31f8-4224-8165-a81448a8272a",
      "name": "Create sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Create sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Information Extractor": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Information Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        []
      ]
    },
    "Create sheet": {
      "main": [
        []
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "Gsky0fZoFcZtOIAf"
  },
  "versionId": "7178b83e-761d-47c9-ac99-341b859fa2d2",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "Gsky0fZoFcZtOIAf",
  "tags": []
}