From 8458fa3eb063368f90b270efd4ea83cf008f6477 Mon Sep 17 00:00:00 2001 From: Isaac_Aracena Date: Sun, 5 Jul 2026 04:00:33 +0000 Subject: [PATCH] Create backup: Formulario_GT_Seguridad --- formulario-gt-seguridad.json | 2099 ++++++++++++++++++++++++++++++++++ 1 file changed, 2099 insertions(+) create mode 100644 formulario-gt-seguridad.json diff --git a/formulario-gt-seguridad.json b/formulario-gt-seguridad.json new file mode 100644 index 0000000..6eec02a --- /dev/null +++ b/formulario-gt-seguridad.json @@ -0,0 +1,2099 @@ +{ + "updatedAt": "2026-06-30T14:01:23.256Z", + "createdAt": "2026-06-26T16:45:21.564Z", + "id": "MJw54TamRSuKs2vX", + "name": "Formulario_GT_Seguridad", + "description": null, + "active": true, + "isArchived": false, + "nodes": [ + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1KgjH_CtdSwrFKsddnF6s0joAIMkplezQXiZwlM-9GSw", + "mode": "list", + "cachedResultName": "Listado de usuarios", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1KgjH_CtdSwrFKsddnF6s0joAIMkplezQXiZwlM-9GSw/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "RD", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1KgjH_CtdSwrFKsddnF6s0joAIMkplezQXiZwlM-9GSw/edit#gid=0" + }, + "filtersUI": { + "values": [ + { + "lookupColumn": "Salida", + "lookupValue": "={{\n (\n Number($('On form submission').item.json['Mes a validar']) === 12\n ? `12-${Number($now.format('yyyy')) - 1}`\n : `${String($('On form submission').item.json['Mes a validar']).padStart(2,'0')}-${$now.format('yyyy')}`\n )\n}}" + }, + { + "lookupColumn": "Salida", + "lookupValue": "Fecha inválida" + }, + { + "lookupColumn": "Salida", + "lookupValue": "={{\n(() => {\n const mes = Number($('On form submission').item.json['Mes a validar']);\n const year = Number($now.format('yyyy'));\n\n const mm = mes === 12 ? 1 : mes + 1;\n const yyyy = mes === 12 ? year : year;\n\n return String(mm).padStart(2,'0') + '-' + yyyy;\n})()\n}}" + }, + { + "lookupColumn": "Salida", + "lookupValue": "={{ (() => { const mes = Number($('On form submission').item.json['Mes a validar']); const year = Number($now.format('yyyy')); const mm = mes === 12 ? 2 : mes + 1; const yyyy = mes === 12 ? year : year; return String(mm).padStart(2,'0') + '-' + yyyy; })() }}" + } + ] + }, + "combineFilters": "OR", + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1280, + 224 + ], + "id": "e4ca496f-6dd1-4cea-8dcf-cc6a4cc21141", + "name": "Get row(s) in sheet", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "formTitle": "Validar", + "formDescription": "Validar", + "formFields": { + "values": [ + { + "fieldLabel": "Mes a validar", + "fieldType": "dropdown", + "fieldOptions": { + "values": [ + { + "option": "01" + }, + { + "option": "02" + }, + { + "option": "03" + }, + { + "option": "04" + }, + { + "option": "05" + }, + { + "option": "06" + }, + { + "option": "07" + }, + { + "option": "08" + }, + { + "option": "09" + }, + { + "option": "10" + }, + { + "option": "11" + }, + { + "option": "12" + } + ] + }, + "requiredField": true + }, + { + "fieldLabel": "Archivo", + "fieldType": "file", + "multipleFiles": false, + "acceptFileTypes": ".pdf" + }, + { + "fieldLabel": "Nomina", + "fieldType": "file", + "multipleFiles": false, + "acceptFileTypes": ".xlsx, .xls, .csv" + } + ] + }, + "options": { + "ignoreBots": true + } + }, + "type": "n8n-nodes-base.formTrigger", + "typeVersion": 2.3, + "position": [ + -448, + 304 + ], + "id": "853ec276-63d7-4d57-b6b0-8e5d647bf400", + "name": "On form submission", + "webhookId": "172477ef-21c0-48f1-b33c-8641dddc2e95" + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=0" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 0, + 0 + ], + "id": "71d25dd8-b145-4958-85f2-d07b0198b8a4", + "name": "Clear sheet", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=0" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1280, + 400 + ], + "id": "acc93c6b-87d3-4e0a-a803-5f8530bb2130", + "name": "Get row(s) in sheet1", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "mode": "combine", + "advanced": true, + "mergeByFields": { + "values": [ + { + "field1": "ID/Cedula", + "field2": "cedulas" + } + ] + }, + "joinMode": "keepNonMatches", + "outputDataFrom": "input2", + "options": {} + }, + "type": "n8n-nodes-base.merge", + "typeVersion": 3.2, + "position": [ + 1584, + 304 + ], + "id": "93d8bf92-7d10-46a6-b294-674ddf4f1433", + "name": "Merge" + }, + { + "parameters": { + "sendTo": "lmatos@gomezleemarketing.com", + "subject": "Empleados en TSS a Validar", + "emailType": "text", + "message": "=Hola Luis,\n\nAqui el listado de usuarios a validar segun el reporte de TSS y BambooHR:\n\n{{ $items().map(i => i.json.cedulas).join(\"\\n\") }}\n\n\nGracias,", + "options": {} + }, + "type": "n8n-nodes-base.gmail", + "typeVersion": 2.2, + "position": [ + 1824, + 304 + ], + "id": "78c28e50-f7d7-4a45-9cfb-8e02e3f87f4c", + "name": "Send a message", + "webhookId": "c30db6a0-d3de-4112-b79c-9de0e9eaebbf", + "executeOnce": true, + "credentials": { + "gmailOAuth2": { + "id": "UDcO1FLJqA453V2D", + "name": "Gmail account 3" + } + } + }, + { + "parameters": { + "operation": "update", + "fileId": { + "__rl": true, + "value": "1za7ZdPAGsEbfktl5tuC6LbEZ8f7tiTCi_BszQeA-EO4", + "mode": "list", + "cachedResultName": "Nomina Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1za7ZdPAGsEbfktl5tuC6LbEZ8f7tiTCi_BszQeA-EO4/edit?usp=drivesdk" + }, + "changeFileContent": true, + "inputDataFieldName": "Nomina", + "options": {} + }, + "type": "n8n-nodes-base.googleDrive", + "typeVersion": 3, + "position": [ + -96, + 624 + ], + "id": "7ffb6ab3-f974-46b5-b9e4-70e983266b54", + "name": "Update file", + "credentials": { + "googleDriveOAuth2Api": { + "id": "g23xdGLZRzBGqKgH", + "name": "Isaac - Google Drive" + } + } + }, + { + "parameters": { + "url": "=https://sheets.googleapis.com/v4/spreadsheets/{{ $json.id }}?fields=sheets(properties(title,sheetId))", + "authentication": "predefinedCredentialType", + "nodeCredentialType": "googleDriveOAuth2Api", + "options": {} + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 80, + 640 + ], + "id": "3ac44446-3008-44d9-b2d7-6b575a79cf2d", + "name": "HTTP Request", + "credentials": { + "googleDriveOAuth2Api": { + "id": "g23xdGLZRzBGqKgH", + "name": "Isaac - Google Drive" + } + } + }, + { + "parameters": { + "options": {} + }, + "type": "n8n-nodes-base.splitInBatches", + "typeVersion": 3, + "position": [ + 544, + 608 + ], + "id": "d05d7b00-1bb8-4e06-b87d-1bda36fe52d2", + "name": "Loop Over Items" + }, + { + "parameters": {}, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 1728, + 704 + ], + "id": "1aed6bb1-b9f8-4d95-a2a8-0fddcee2d610", + "name": "Wait", + "webhookId": "9ace66f1-15da-4905-9081-fed532107e20" + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1za7ZdPAGsEbfktl5tuC6LbEZ8f7tiTCi_BszQeA-EO4", + "mode": "list", + "cachedResultName": "Nomina Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1za7ZdPAGsEbfktl5tuC6LbEZ8f7tiTCi_BszQeA-EO4/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "={{ $json.sheetId }}", + "mode": "id" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 752, + 672 + ], + "id": "4b39b6a5-d710-4511-b3fc-2538eb879d66", + "name": "Get row(s) in sheet2", + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "operation": "append", + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=1217920095" + }, + "columns": { + "mappingMode": "defineBelow", + "value": { + "IGSS": "={{ $json.IGSS }}" + }, + "matchingColumns": [ + "ID" + ], + "schema": [ + { + "id": "IGSS", + "displayName": "IGSS", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": true, + "removed": false + } + ], + "attemptToConvertTypes": false, + "convertFieldsToString": false + }, + "options": { + "cellFormat": "RAW" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1472, + 704 + ], + "id": "d016191d-b0b0-455e-83d8-8abaef562632", + "name": "Append row in sheet1", + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + }, + "onError": "continueRegularOutput" + }, + { + "parameters": { + "jsCode": "const sheets = $json.sheets || [];\nreturn sheets.map(s => ({\n json: {\n sheetTitle: s.properties.title,\n sheetId: s.properties.sheetId,\n }\n}));" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 240, + 640 + ], + "id": "e7c8fcef-1900-422d-bc7e-ead511cc1698", + "name": "Code in JavaScript1" + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=1217920095" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1296, + 576 + ], + "id": "6c623005-5ed9-4ab0-a743-48f472e0bb2f", + "name": "Get row(s) in sheet3", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "mode": "combine", + "advanced": true, + "mergeByFields": { + "values": [ + { + "field1": "no_afiliacion", + "field2": "IGSS" + } + ] + }, + "joinMode": "keepNonMatches", + "outputDataFrom": "input1", + "options": {} + }, + "type": "n8n-nodes-base.merge", + "typeVersion": 3.2, + "position": [ + 1584, + 496 + ], + "id": "ed246290-e3ae-4dfb-beea-02eda1c119e9", + "name": "Merge1" + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=1217920095" + }, + "keepFirstRow": true + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1680, + 48 + ], + "id": "ae8aa586-83a2-403a-ad9b-a00622fc585b", + "name": "Clear sheet1", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "sendTo": "lmatos@gomezleemarketing.com", + "subject": "Empleados en TSS a Validar", + "emailType": "text", + "message": "=Hola Luis,\n\nAqui el listado de usuarios a validar segun el reporte de TSS y Nomina:\n\n{{ $items().map(i => i.json.no_afiliacion).join(\"\\n\") }}\n\nGracias,", + "options": {} + }, + "type": "n8n-nodes-base.gmail", + "typeVersion": 2.2, + "position": [ + 1840, + 496 + ], + "id": "a4e7150f-5a16-4fd1-9ade-c73505a829c1", + "name": "Send a message1", + "webhookId": "00e87d77-f989-43aa-90b0-de8643b15b66", + "executeOnce": true, + "credentials": { + "gmailOAuth2": { + "id": "UDcO1FLJqA453V2D", + "name": "Gmail account 3" + } + } + }, + { + "parameters": { + "operation": "update", + "fileId": { + "__rl": true, + "value": "18VmaHViUAZWveaULQsFgWXaztke82lo_Bll_j7X2EVg", + "mode": "list", + "cachedResultName": "ComparacionTSS", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18VmaHViUAZWveaULQsFgWXaztke82lo_Bll_j7X2EVg/edit?usp=drivesdk" + }, + "changeFileContent": true, + "inputDataFieldName": "Archivo", + "newUpdatedFileName": "=", + "options": { + "useContentAsIndexableText": false + } + }, + "type": "n8n-nodes-base.googleDrive", + "typeVersion": 3, + "position": [ + 464, + 384 + ], + "id": "64a2bca4-22f0-4b67-abb6-df01706e16da", + "name": "Update file1", + "credentials": { + "googleDriveOAuth2Api": { + "id": "g23xdGLZRzBGqKgH", + "name": "Isaac - Google Drive" + } + } + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=1217920095" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 272, + 0 + ], + "id": "75adac93-63cf-49fa-9509-e93ab6448822", + "name": "Clear sheet2", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "18VmaHViUAZWveaULQsFgWXaztke82lo_Bll_j7X2EVg", + "mode": "list", + "cachedResultName": "ComparacionTSS", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18VmaHViUAZWveaULQsFgWXaztke82lo_Bll_j7X2EVg/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "Constancia de Recepcion - TSS D", + "mode": "name" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 416, + 208 + ], + "id": "51d93a9a-7d56-428d-81e1-17ec9ba36740", + "name": "Get row(s) in sheet4", + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "eb0a586c-64e0-442e-b5c1-111f4f1e6810", + "name": "cedulas", + "value": "={{\n String($json[\"NO_DOCUMENTO\"])\n .replace(/\\D/g, '')\n .padStart(11, '0')\n .replace(/^(\\d{3})(\\d{7})(\\d)$/, \"$1-$2-$3\")\n}}", + "type": "string" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 608, + 208 + ], + "id": "9b79f63a-764e-4714-9b79-685ff4b1aa38", + "name": "Edit Fields" + }, + { + "parameters": { + "operation": "append", + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=0" + }, + "columns": { + "mappingMode": "autoMapInputData", + "value": {}, + "matchingColumns": [ + "no_afiliacion" + ], + "schema": [ + { + "id": "no_afiliacion", + "displayName": "no_afiliacion", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": true, + "removed": false + } + ], + "attemptToConvertTypes": false, + "convertFieldsToString": false + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1296, + 48 + ], + "id": "a9d7537f-b1cd-4e0d-a6c7-743242857fd7", + "name": "Append row in sheet", + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "operation": "pdf", + "binaryPropertyName": "Archivo", + "options": {} + }, + "type": "n8n-nodes-base.extractFromFile", + "typeVersion": 1.1, + "position": [ + 480, + 0 + ], + "id": "c89d92f2-2a27-4505-a6f1-165ed76c0549", + "name": "Extract from File" + }, + { + "parameters": { + "jsCode": "const items = $input.all();\n\nlet afiliaciones = [];\n\nfor (const item of items) {\n let text = item.json.text || '';\n text = text.replace(/\\r/g, '');\n\n // Buscar solo la tabla de trabajadores\n const startIndex = text.indexOf('32. No.');\n if (startIndex === -1) continue;\n\n text = text.slice(startIndex);\n\n const lines = text\n .split('\\n')\n .map(l => l.trim())\n .filter(Boolean);\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n // Debe comenzar con una línea numérica\n if (!/^\\d{8,11}$/.test(line)) continue;\n\n let numero = line;\n\n // Si la siguiente línea es 1-2 dígitos, probablemente es continuación\n if (/^\\d{1,2}$/.test(lines[i + 1] || '')) {\n numero += lines[i + 1];\n i++;\n\n // Si todavía hay otro fragmento corto, también unirlo\n if (/^\\d{1,2}$/.test(lines[i + 1] || '')) {\n numero += lines[i + 1];\n i++;\n }\n }\n\n afiliaciones.push(numero);\n }\n}\n\n// Limpiar y deduplicar\nafiliaciones = [...new Set(\n afiliaciones\n .map(n => n.replace(/\\D/g, ''))\n .filter(n => n.length >= 8 && n.length <= 13)\n)];\n\nreturn afiliaciones.map(num => ({\n json: {\n no_afiliacion: num\n }\n}));" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 704, + 0 + ], + "id": "11829b52-2fc7-44b3-982a-041560727913", + "name": "Code in JavaScript" + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "7712a83a-adff-4753-8503-935d71c7808a", + "name": "IGSS", + "value": "={{ $json.IGSS }}", + "type": "number" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 1248, + 720 + ], + "id": "8541f6c1-e189-4aec-ac4a-d546dc8dd875", + "name": "Edit Fields1", + "onError": "continueErrorOutput" + } + ], + "connections": { + "On form submission": { + "main": [ + [ + { + "node": "Update file", + "type": "main", + "index": 0 + }, + { + "node": "Clear sheet", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get row(s) in sheet": { + "main": [ + [ + { + "node": "Merge", + "type": "main", + "index": 0 + } + ] + ] + }, + "Clear sheet": { + "main": [ + [ + { + "node": "Clear sheet2", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get row(s) in sheet1": { + "main": [ + [ + { + "node": "Merge1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Merge": { + "main": [ + [ + { + "node": "Send a message", + "type": "main", + "index": 0 + } + ] + ] + }, + "Update file": { + "main": [ + [ + { + "node": "HTTP Request", + "type": "main", + "index": 0 + } + ] + ] + }, + "HTTP Request": { + "main": [ + [ + { + "node": "Code in JavaScript1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Loop Over Items": { + "main": [ + [ + { + "node": "Get row(s) in sheet1", + "type": "main", + "index": 0 + }, + { + "node": "Get row(s) in sheet3", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "Get row(s) in sheet2", + "type": "main", + "index": 0 + } + ] + ] + }, + "Wait": { + "main": [ + [ + { + "node": "Loop Over Items", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get row(s) in sheet2": { + "main": [ + [ + { + "node": "Edit Fields1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Append row in sheet1": { + "main": [ + [ + { + "node": "Wait", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code in JavaScript1": { + "main": [ + [ + { + "node": "Loop Over Items", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get row(s) in sheet3": { + "main": [ + [ + { + "node": "Merge1", + "type": "main", + "index": 1 + } + ] + ] + }, + "Merge1": { + "main": [ + [ + { + "node": "Send a message1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Clear sheet2": { + "main": [ + [ + { + "node": "Extract from File", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get row(s) in sheet4": { + "main": [ + [ + { + "node": "Edit Fields", + "type": "main", + "index": 0 + } + ] + ] + }, + "Append row in sheet": { + "main": [ + [ + { + "node": "Clear sheet1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Extract from File": { + "main": [ + [ + { + "node": "Code in JavaScript", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code in JavaScript": { + "main": [ + [ + { + "node": "Append row in sheet", + "type": "main", + "index": 0 + } + ] + ] + }, + "Edit Fields1": { + "main": [ + [ + { + "node": "Append row in sheet1", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "settings": { + "executionOrder": "v1", + "binaryMode": "separate" + }, + "staticData": null, + "meta": { + "templateCredsSetupCompleted": true + }, + "versionId": "8b20bd02-40bc-4421-97a3-6f530f8dc77b", + "activeVersionId": "8b20bd02-40bc-4421-97a3-6f530f8dc77b", + "versionCounter": 21, + "triggerCount": 1, + "shared": [ + { + "updatedAt": "2026-06-26T16:45:21.571Z", + "createdAt": "2026-06-26T16:45:21.571Z", + "role": "workflow:owner", + "workflowId": "MJw54TamRSuKs2vX", + "projectId": "PJpTANzTXIFibWsW", + "project": { + "updatedAt": "2026-04-22T14:25:09.686Z", + "createdAt": "2026-04-22T14:22:54.790Z", + "id": "PJpTANzTXIFibWsW", + "name": "Isaac Aracena ", + "type": "personal", + "icon": null, + "description": null, + "creatorId": "0a88c0b1-928e-4412-896e-c5d1c99b2029" + } + } + ], + "tags": [], + "activeVersion": { + "updatedAt": "2026-06-30T14:22:52.000Z", + "createdAt": "2026-06-30T14:01:23.258Z", + "versionId": "8b20bd02-40bc-4421-97a3-6f530f8dc77b", + "workflowId": "MJw54TamRSuKs2vX", + "nodes": [ + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1KgjH_CtdSwrFKsddnF6s0joAIMkplezQXiZwlM-9GSw", + "mode": "list", + "cachedResultName": "Listado de usuarios", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1KgjH_CtdSwrFKsddnF6s0joAIMkplezQXiZwlM-9GSw/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "RD", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1KgjH_CtdSwrFKsddnF6s0joAIMkplezQXiZwlM-9GSw/edit#gid=0" + }, + "filtersUI": { + "values": [ + { + "lookupColumn": "Salida", + "lookupValue": "={{\n (\n Number($('On form submission').item.json['Mes a validar']) === 12\n ? `12-${Number($now.format('yyyy')) - 1}`\n : `${String($('On form submission').item.json['Mes a validar']).padStart(2,'0')}-${$now.format('yyyy')}`\n )\n}}" + }, + { + "lookupColumn": "Salida", + "lookupValue": "Fecha inválida" + }, + { + "lookupColumn": "Salida", + "lookupValue": "={{\n(() => {\n const mes = Number($('On form submission').item.json['Mes a validar']);\n const year = Number($now.format('yyyy'));\n\n const mm = mes === 12 ? 1 : mes + 1;\n const yyyy = mes === 12 ? year : year;\n\n return String(mm).padStart(2,'0') + '-' + yyyy;\n})()\n}}" + }, + { + "lookupColumn": "Salida", + "lookupValue": "={{ (() => { const mes = Number($('On form submission').item.json['Mes a validar']); const year = Number($now.format('yyyy')); const mm = mes === 12 ? 2 : mes + 1; const yyyy = mes === 12 ? year : year; return String(mm).padStart(2,'0') + '-' + yyyy; })() }}" + } + ] + }, + "combineFilters": "OR", + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1280, + 224 + ], + "id": "e4ca496f-6dd1-4cea-8dcf-cc6a4cc21141", + "name": "Get row(s) in sheet", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "formTitle": "Validar", + "formDescription": "Validar", + "formFields": { + "values": [ + { + "fieldLabel": "Mes a validar", + "fieldType": "dropdown", + "fieldOptions": { + "values": [ + { + "option": "01" + }, + { + "option": "02" + }, + { + "option": "03" + }, + { + "option": "04" + }, + { + "option": "05" + }, + { + "option": "06" + }, + { + "option": "07" + }, + { + "option": "08" + }, + { + "option": "09" + }, + { + "option": "10" + }, + { + "option": "11" + }, + { + "option": "12" + } + ] + }, + "requiredField": true + }, + { + "fieldLabel": "Archivo", + "fieldType": "file", + "multipleFiles": false, + "acceptFileTypes": ".pdf" + }, + { + "fieldLabel": "Nomina", + "fieldType": "file", + "multipleFiles": false, + "acceptFileTypes": ".xlsx, .xls, .csv" + } + ] + }, + "options": { + "ignoreBots": true + } + }, + "type": "n8n-nodes-base.formTrigger", + "typeVersion": 2.3, + "position": [ + -448, + 304 + ], + "id": "853ec276-63d7-4d57-b6b0-8e5d647bf400", + "name": "On form submission", + "webhookId": "172477ef-21c0-48f1-b33c-8641dddc2e95" + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=0" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 0, + 0 + ], + "id": "71d25dd8-b145-4958-85f2-d07b0198b8a4", + "name": "Clear sheet", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=0" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1280, + 400 + ], + "id": "acc93c6b-87d3-4e0a-a803-5f8530bb2130", + "name": "Get row(s) in sheet1", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "mode": "combine", + "advanced": true, + "mergeByFields": { + "values": [ + { + "field1": "ID/Cedula", + "field2": "cedulas" + } + ] + }, + "joinMode": "keepNonMatches", + "outputDataFrom": "input2", + "options": {} + }, + "type": "n8n-nodes-base.merge", + "typeVersion": 3.2, + "position": [ + 1584, + 304 + ], + "id": "93d8bf92-7d10-46a6-b294-674ddf4f1433", + "name": "Merge" + }, + { + "parameters": { + "sendTo": "lmatos@gomezleemarketing.com", + "subject": "Empleados en TSS a Validar", + "emailType": "text", + "message": "=Hola Luis,\n\nAqui el listado de usuarios a validar segun el reporte de TSS y BambooHR:\n\n{{ $items().map(i => i.json.cedulas).join(\"\\n\") }}\n\n\nGracias,", + "options": {} + }, + "type": "n8n-nodes-base.gmail", + "typeVersion": 2.2, + "position": [ + 1824, + 304 + ], + "id": "78c28e50-f7d7-4a45-9cfb-8e02e3f87f4c", + "name": "Send a message", + "webhookId": "c30db6a0-d3de-4112-b79c-9de0e9eaebbf", + "executeOnce": true, + "credentials": { + "gmailOAuth2": { + "id": "UDcO1FLJqA453V2D", + "name": "Gmail account 3" + } + } + }, + { + "parameters": { + "operation": "update", + "fileId": { + "__rl": true, + "value": "1za7ZdPAGsEbfktl5tuC6LbEZ8f7tiTCi_BszQeA-EO4", + "mode": "list", + "cachedResultName": "Nomina Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1za7ZdPAGsEbfktl5tuC6LbEZ8f7tiTCi_BszQeA-EO4/edit?usp=drivesdk" + }, + "changeFileContent": true, + "inputDataFieldName": "Nomina", + "options": {} + }, + "type": "n8n-nodes-base.googleDrive", + "typeVersion": 3, + "position": [ + -96, + 624 + ], + "id": "7ffb6ab3-f974-46b5-b9e4-70e983266b54", + "name": "Update file", + "credentials": { + "googleDriveOAuth2Api": { + "id": "g23xdGLZRzBGqKgH", + "name": "Isaac - Google Drive" + } + } + }, + { + "parameters": { + "url": "=https://sheets.googleapis.com/v4/spreadsheets/{{ $json.id }}?fields=sheets(properties(title,sheetId))", + "authentication": "predefinedCredentialType", + "nodeCredentialType": "googleDriveOAuth2Api", + "options": {} + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 80, + 640 + ], + "id": "3ac44446-3008-44d9-b2d7-6b575a79cf2d", + "name": "HTTP Request", + "credentials": { + "googleDriveOAuth2Api": { + "id": "g23xdGLZRzBGqKgH", + "name": "Isaac - Google Drive" + } + } + }, + { + "parameters": { + "options": {} + }, + "type": "n8n-nodes-base.splitInBatches", + "typeVersion": 3, + "position": [ + 544, + 608 + ], + "id": "d05d7b00-1bb8-4e06-b87d-1bda36fe52d2", + "name": "Loop Over Items" + }, + { + "parameters": {}, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 1728, + 704 + ], + "id": "1aed6bb1-b9f8-4d95-a2a8-0fddcee2d610", + "name": "Wait", + "webhookId": "9ace66f1-15da-4905-9081-fed532107e20" + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1za7ZdPAGsEbfktl5tuC6LbEZ8f7tiTCi_BszQeA-EO4", + "mode": "list", + "cachedResultName": "Nomina Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1za7ZdPAGsEbfktl5tuC6LbEZ8f7tiTCi_BszQeA-EO4/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "={{ $json.sheetId }}", + "mode": "id" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 752, + 672 + ], + "id": "4b39b6a5-d710-4511-b3fc-2538eb879d66", + "name": "Get row(s) in sheet2", + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "operation": "append", + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=1217920095" + }, + "columns": { + "mappingMode": "defineBelow", + "value": { + "IGSS": "={{ $json.IGSS }}" + }, + "matchingColumns": [ + "ID" + ], + "schema": [ + { + "id": "IGSS", + "displayName": "IGSS", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": true, + "removed": false + } + ], + "attemptToConvertTypes": false, + "convertFieldsToString": false + }, + "options": { + "cellFormat": "RAW" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1472, + 704 + ], + "id": "d016191d-b0b0-455e-83d8-8abaef562632", + "name": "Append row in sheet1", + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + }, + "onError": "continueRegularOutput" + }, + { + "parameters": { + "jsCode": "const sheets = $json.sheets || [];\nreturn sheets.map(s => ({\n json: {\n sheetTitle: s.properties.title,\n sheetId: s.properties.sheetId,\n }\n}));" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 240, + 640 + ], + "id": "e7c8fcef-1900-422d-bc7e-ead511cc1698", + "name": "Code in JavaScript1" + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=1217920095" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1296, + 576 + ], + "id": "6c623005-5ed9-4ab0-a743-48f472e0bb2f", + "name": "Get row(s) in sheet3", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "mode": "combine", + "advanced": true, + "mergeByFields": { + "values": [ + { + "field1": "no_afiliacion", + "field2": "IGSS" + } + ] + }, + "joinMode": "keepNonMatches", + "outputDataFrom": "input1", + "options": {} + }, + "type": "n8n-nodes-base.merge", + "typeVersion": 3.2, + "position": [ + 1584, + 496 + ], + "id": "ed246290-e3ae-4dfb-beea-02eda1c119e9", + "name": "Merge1" + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=1217920095" + }, + "keepFirstRow": true + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1680, + 48 + ], + "id": "ae8aa586-83a2-403a-ad9b-a00622fc585b", + "name": "Clear sheet1", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "sendTo": "lmatos@gomezleemarketing.com", + "subject": "Empleados en TSS a Validar", + "emailType": "text", + "message": "=Hola Luis,\n\nAqui el listado de usuarios a validar segun el reporte de TSS y Nomina:\n\n{{ $items().map(i => i.json.no_afiliacion).join(\"\\n\") }}\n\nGracias,", + "options": {} + }, + "type": "n8n-nodes-base.gmail", + "typeVersion": 2.2, + "position": [ + 1840, + 496 + ], + "id": "a4e7150f-5a16-4fd1-9ade-c73505a829c1", + "name": "Send a message1", + "webhookId": "00e87d77-f989-43aa-90b0-de8643b15b66", + "executeOnce": true, + "credentials": { + "gmailOAuth2": { + "id": "UDcO1FLJqA453V2D", + "name": "Gmail account 3" + } + } + }, + { + "parameters": { + "operation": "update", + "fileId": { + "__rl": true, + "value": "18VmaHViUAZWveaULQsFgWXaztke82lo_Bll_j7X2EVg", + "mode": "list", + "cachedResultName": "ComparacionTSS", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18VmaHViUAZWveaULQsFgWXaztke82lo_Bll_j7X2EVg/edit?usp=drivesdk" + }, + "changeFileContent": true, + "inputDataFieldName": "Archivo", + "newUpdatedFileName": "=", + "options": { + "useContentAsIndexableText": false + } + }, + "type": "n8n-nodes-base.googleDrive", + "typeVersion": 3, + "position": [ + 464, + 384 + ], + "id": "64a2bca4-22f0-4b67-abb6-df01706e16da", + "name": "Update file1", + "credentials": { + "googleDriveOAuth2Api": { + "id": "g23xdGLZRzBGqKgH", + "name": "Isaac - Google Drive" + } + } + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=1217920095" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 272, + 0 + ], + "id": "75adac93-63cf-49fa-9509-e93ab6448822", + "name": "Clear sheet2", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "18VmaHViUAZWveaULQsFgWXaztke82lo_Bll_j7X2EVg", + "mode": "list", + "cachedResultName": "ComparacionTSS", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18VmaHViUAZWveaULQsFgWXaztke82lo_Bll_j7X2EVg/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "Constancia de Recepcion - TSS D", + "mode": "name" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 416, + 208 + ], + "id": "51d93a9a-7d56-428d-81e1-17ec9ba36740", + "name": "Get row(s) in sheet4", + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "eb0a586c-64e0-442e-b5c1-111f4f1e6810", + "name": "cedulas", + "value": "={{\n String($json[\"NO_DOCUMENTO\"])\n .replace(/\\D/g, '')\n .padStart(11, '0')\n .replace(/^(\\d{3})(\\d{7})(\\d)$/, \"$1-$2-$3\")\n}}", + "type": "string" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 608, + 208 + ], + "id": "9b79f63a-764e-4714-9b79-685ff4b1aa38", + "name": "Edit Fields" + }, + { + "parameters": { + "operation": "append", + "documentId": { + "__rl": true, + "value": "1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM", + "mode": "list", + "cachedResultName": "TSS Guatemala", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1lLpSWswKv-cOPWezTEB4yHvhuHThifXgbge0xmoZFMM/edit#gid=0" + }, + "columns": { + "mappingMode": "autoMapInputData", + "value": {}, + "matchingColumns": [ + "no_afiliacion" + ], + "schema": [ + { + "id": "no_afiliacion", + "displayName": "no_afiliacion", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": true, + "removed": false + } + ], + "attemptToConvertTypes": false, + "convertFieldsToString": false + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1296, + 48 + ], + "id": "a9d7537f-b1cd-4e0d-a6c7-743242857fd7", + "name": "Append row in sheet", + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "operation": "pdf", + "binaryPropertyName": "Archivo", + "options": {} + }, + "type": "n8n-nodes-base.extractFromFile", + "typeVersion": 1.1, + "position": [ + 480, + 0 + ], + "id": "c89d92f2-2a27-4505-a6f1-165ed76c0549", + "name": "Extract from File" + }, + { + "parameters": { + "jsCode": "const items = $input.all();\n\nlet afiliaciones = [];\n\nfor (const item of items) {\n let text = item.json.text || '';\n text = text.replace(/\\r/g, '');\n\n // Buscar solo la tabla de trabajadores\n const startIndex = text.indexOf('32. No.');\n if (startIndex === -1) continue;\n\n text = text.slice(startIndex);\n\n const lines = text\n .split('\\n')\n .map(l => l.trim())\n .filter(Boolean);\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n // Debe comenzar con una línea numérica\n if (!/^\\d{8,11}$/.test(line)) continue;\n\n let numero = line;\n\n // Si la siguiente línea es 1-2 dígitos, probablemente es continuación\n if (/^\\d{1,2}$/.test(lines[i + 1] || '')) {\n numero += lines[i + 1];\n i++;\n\n // Si todavía hay otro fragmento corto, también unirlo\n if (/^\\d{1,2}$/.test(lines[i + 1] || '')) {\n numero += lines[i + 1];\n i++;\n }\n }\n\n afiliaciones.push(numero);\n }\n}\n\n// Limpiar y deduplicar\nafiliaciones = [...new Set(\n afiliaciones\n .map(n => n.replace(/\\D/g, ''))\n .filter(n => n.length >= 8 && n.length <= 13)\n)];\n\nreturn afiliaciones.map(num => ({\n json: {\n no_afiliacion: num\n }\n}));" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 704, + 0 + ], + "id": "11829b52-2fc7-44b3-982a-041560727913", + "name": "Code in JavaScript" + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "7712a83a-adff-4753-8503-935d71c7808a", + "name": "IGSS", + "value": "={{ $json.IGSS }}", + "type": "number" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 1248, + 720 + ], + "id": "8541f6c1-e189-4aec-ac4a-d546dc8dd875", + "name": "Edit Fields1", + "onError": "continueErrorOutput" + } + ], + "connections": { + "On form submission": { + "main": [ + [ + { + "node": "Update file", + "type": "main", + "index": 0 + }, + { + "node": "Clear sheet", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get row(s) in sheet": { + "main": [ + [ + { + "node": "Merge", + "type": "main", + "index": 0 + } + ] + ] + }, + "Clear sheet": { + "main": [ + [ + { + "node": "Clear sheet2", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get row(s) in sheet1": { + "main": [ + [ + { + "node": "Merge1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Merge": { + "main": [ + [ + { + "node": "Send a message", + "type": "main", + "index": 0 + } + ] + ] + }, + "Update file": { + "main": [ + [ + { + "node": "HTTP Request", + "type": "main", + "index": 0 + } + ] + ] + }, + "HTTP Request": { + "main": [ + [ + { + "node": "Code in JavaScript1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Loop Over Items": { + "main": [ + [ + { + "node": "Get row(s) in sheet1", + "type": "main", + "index": 0 + }, + { + "node": "Get row(s) in sheet3", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "Get row(s) in sheet2", + "type": "main", + "index": 0 + } + ] + ] + }, + "Wait": { + "main": [ + [ + { + "node": "Loop Over Items", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get row(s) in sheet2": { + "main": [ + [ + { + "node": "Edit Fields1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Append row in sheet1": { + "main": [ + [ + { + "node": "Wait", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code in JavaScript1": { + "main": [ + [ + { + "node": "Loop Over Items", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get row(s) in sheet3": { + "main": [ + [ + { + "node": "Merge1", + "type": "main", + "index": 1 + } + ] + ] + }, + "Merge1": { + "main": [ + [ + { + "node": "Send a message1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Clear sheet2": { + "main": [ + [ + { + "node": "Extract from File", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get row(s) in sheet4": { + "main": [ + [ + { + "node": "Edit Fields", + "type": "main", + "index": 0 + } + ] + ] + }, + "Append row in sheet": { + "main": [ + [ + { + "node": "Clear sheet1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Extract from File": { + "main": [ + [ + { + "node": "Code in JavaScript", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code in JavaScript": { + "main": [ + [ + { + "node": "Append row in sheet", + "type": "main", + "index": 0 + } + ] + ] + }, + "Edit Fields1": { + "main": [ + [ + { + "node": "Append row in sheet1", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "authors": "Isaac Aracena", + "name": "Version 8b20bd02", + "description": "", + "autosaved": true, + "workflowPublishHistory": [ + { + "createdAt": "2026-06-30T14:22:52.302Z", + "id": 2057, + "workflowId": "MJw54TamRSuKs2vX", + "versionId": "8b20bd02-40bc-4421-97a3-6f530f8dc77b", + "event": "activated", + "userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029" + } + ] + } +} \ No newline at end of file