diff --git a/formulario-hn-seguridad.json b/formulario-hn-seguridad.json new file mode 100644 index 0000000..577286d --- /dev/null +++ b/formulario-hn-seguridad.json @@ -0,0 +1,2093 @@ +{ + "updatedAt": "2026-06-30T14:10:51.676Z", + "createdAt": "2026-06-26T16:46:19.142Z", + "id": "HXEZPnVf1ALsLncE", + "name": "Formulario_HN_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": [ + 1104, + 160 + ], + "id": "feb4c8e6-8b78-4ad8-9c44-a0fad3450214", + "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": "8b081171-dc70-4c82-a1f3-210fb8f462d3", + "name": "On form submission", + "webhookId": "0a1f9c63-1826-428a-8fad-b1d740eaf308" + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=0" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 0, + 0 + ], + "id": "4d388fef-4de3-43e7-83ef-836ff1f3be65", + "name": "Clear sheet", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=0" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1104, + 336 + ], + "id": "beaa243e-1eb3-46dd-a320-1956b8a87024", + "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": [ + 1408, + 240 + ], + "id": "864824ca-3938-4eea-a9f6-240e3ff7a14a", + "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": [ + 1648, + 240 + ], + "id": "0a09e9ca-0050-4670-9685-94ddf2914c21", + "name": "Send a message", + "webhookId": "cb8dd745-e0e1-4876-ab86-50501e2c66dd", + "executeOnce": true, + "credentials": { + "gmailOAuth2": { + "id": "UDcO1FLJqA453V2D", + "name": "Gmail account 3" + } + } + }, + { + "parameters": { + "operation": "update", + "fileId": { + "__rl": true, + "value": "1LNJtm2ITumAFGQwWmHXpoeSOWXBXjdTDpjSBBwqnHd4", + "mode": "list", + "cachedResultName": "Nomina Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LNJtm2ITumAFGQwWmHXpoeSOWXBXjdTDpjSBBwqnHd4/edit?usp=drivesdk" + }, + "changeFileContent": true, + "inputDataFieldName": "Nomina", + "options": {} + }, + "type": "n8n-nodes-base.googleDrive", + "typeVersion": 3, + "position": [ + -96, + 624 + ], + "id": "fb1eebd6-f171-460d-85e8-6f95206af3ea", + "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": "46715f4d-1922-4c92-8a89-9e28094f58d9", + "name": "HTTP Request", + "credentials": { + "googleDriveOAuth2Api": { + "id": "g23xdGLZRzBGqKgH", + "name": "Isaac - Google Drive" + } + } + }, + { + "parameters": { + "options": {} + }, + "type": "n8n-nodes-base.splitInBatches", + "typeVersion": 3, + "position": [ + 544, + 608 + ], + "id": "457257ac-1057-4294-8e64-81e47518252e", + "name": "Loop Over Items" + }, + { + "parameters": {}, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 1552, + 640 + ], + "id": "ed3d30a9-c8ad-4257-b35c-7ae387bc4ef0", + "name": "Wait", + "webhookId": "1e29dae8-b949-44b2-9dc8-a8e8ca037878" + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1LNJtm2ITumAFGQwWmHXpoeSOWXBXjdTDpjSBBwqnHd4", + "mode": "list", + "cachedResultName": "Nomina Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LNJtm2ITumAFGQwWmHXpoeSOWXBXjdTDpjSBBwqnHd4/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "={{ $json.sheetId }}", + "mode": "id" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 944, + 656 + ], + "id": "fb71e006-6ec3-4a9a-a275-5c0c2bc0cc06", + "name": "Get row(s) in sheet2", + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "operation": "append", + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=1217920095" + }, + "columns": { + "mappingMode": "defineBelow", + "value": { + "Identidad": "={{ $json.Identidad }}" + }, + "matchingColumns": [ + "IGSS" + ], + "schema": [ + { + "id": "Identidad", + "displayName": "Identidad", + "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, + 640 + ], + "id": "32ffb373-d32b-4578-8eee-6637ae08359b", + "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": "e2c86bb4-1e51-431d-8f72-492bcf1679dc", + "name": "Code in JavaScript1" + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=1217920095" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1120, + 512 + ], + "id": "c4fa4012-5fe5-4096-9fc8-6db70bc32dec", + "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": "identidad", + "field2": "Identidad" + } + ] + }, + "joinMode": "keepNonMatches", + "outputDataFrom": "input1", + "options": {} + }, + "type": "n8n-nodes-base.merge", + "typeVersion": 3.2, + "position": [ + 1408, + 432 + ], + "id": "124866da-6498-4ead-a3c4-e897e8f1fddc", + "name": "Merge1" + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=1217920095" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1504, + -16 + ], + "id": "f7db80f6-bc02-43d5-a3fa-dc74baa912cd", + "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": [ + 1664, + 432 + ], + "id": "dff83c05-e7b9-46dd-8bba-ccd11ee4b008", + "name": "Send a message1", + "webhookId": "14c6ce68-f411-4105-9880-268fdaef96db", + "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": "18e9e185-a3a8-42a9-bfe8-a920734d9ddb", + "name": "Update file1", + "credentials": { + "googleDriveOAuth2Api": { + "id": "g23xdGLZRzBGqKgH", + "name": "Isaac - Google Drive" + } + } + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=1217920095" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 272, + 0 + ], + "id": "6297f3fb-1697-4702-84d1-f6d60d71c798", + "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": [ + 480, + 208 + ], + "id": "51c4dc85-ca9a-46d7-b65c-de63e530287d", + "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": "059c1c8b-99d9-479d-accc-9387581c72ef", + "name": "Edit Fields" + }, + { + "parameters": { + "operation": "append", + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/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": [ + 1120, + -16 + ], + "id": "5e044e50-f5e2-4905-91e9-1d4fd694f350", + "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": "3f2c18db-13a9-4b7c-a6b3-5b70ca664070", + "name": "Extract from File" + }, + { + "parameters": { + "jsCode": "const items = $input.all();\n\nlet identidades = [];\n\nfor (const item of items) {\n let text = String(item.json.text || '');\n text = text.replace(/\\r/g, '');\n\n // Quitar acentos para evitar problemas con AFILIACIÓN / IDENTIDAD\n const normalized = text\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n\n // En ESTE PDF, las identidades quedaron entre:\n // \"NO. AFILIACION\" ... \"IDENTIDAD\"\n const match = normalized.match(/NO\\.?\\s*AFILIACION([\\s\\S]*?)IDENTIDAD/i);\n if (!match) continue;\n\n const block = match[1];\n\n // Extraer solo números de 13 dígitos\n const encontrados = block.match(/\\b\\d{13}\\b/g) || [];\n\n identidades.push(...encontrados);\n}\n\n// Deduplicar\nidentidades = [...new Set(identidades)];\n\nreturn identidades.map(id => ({\n json: {\n identidad: id\n }\n}));" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 704, + 0 + ], + "id": "a8ff5615-66d7-41d8-a2b2-2c4d574f445d", + "name": "Code in JavaScript" + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "7712a83a-adff-4753-8503-935d71c7808a", + "name": "Identidad", + "value": "={{ $json['Identidad '] }}", + "type": "number" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 1072, + 656 + ], + "id": "dea3cc43-0ed8-4049-9bf4-a8a2f655cf70", + "name": "Edit Fields1", + "onError": "continueErrorOutput" + } + ], + "connections": { + "On form submission": { + "main": [ + [ + { + "node": "Clear sheet", + "type": "main", + "index": 0 + }, + { + "node": "Update file", + "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": "51c1b554-4884-4531-bae8-151d9d8fac60", + "activeVersionId": "51c1b554-4884-4531-bae8-151d9d8fac60", + "versionCounter": 19, + "triggerCount": 1, + "shared": [ + { + "updatedAt": "2026-06-26T16:46:19.145Z", + "createdAt": "2026-06-26T16:46:19.145Z", + "role": "workflow:owner", + "workflowId": "HXEZPnVf1ALsLncE", + "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-30T15:41:15.000Z", + "createdAt": "2026-06-30T14:10:51.677Z", + "versionId": "51c1b554-4884-4531-bae8-151d9d8fac60", + "workflowId": "HXEZPnVf1ALsLncE", + "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": [ + 1104, + 160 + ], + "id": "feb4c8e6-8b78-4ad8-9c44-a0fad3450214", + "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": "8b081171-dc70-4c82-a1f3-210fb8f462d3", + "name": "On form submission", + "webhookId": "0a1f9c63-1826-428a-8fad-b1d740eaf308" + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=0" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 0, + 0 + ], + "id": "4d388fef-4de3-43e7-83ef-836ff1f3be65", + "name": "Clear sheet", + "executeOnce": true, + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=0" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1104, + 336 + ], + "id": "beaa243e-1eb3-46dd-a320-1956b8a87024", + "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": [ + 1408, + 240 + ], + "id": "864824ca-3938-4eea-a9f6-240e3ff7a14a", + "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": [ + 1648, + 240 + ], + "id": "0a09e9ca-0050-4670-9685-94ddf2914c21", + "name": "Send a message", + "webhookId": "cb8dd745-e0e1-4876-ab86-50501e2c66dd", + "executeOnce": true, + "credentials": { + "gmailOAuth2": { + "id": "UDcO1FLJqA453V2D", + "name": "Gmail account 3" + } + } + }, + { + "parameters": { + "operation": "update", + "fileId": { + "__rl": true, + "value": "1LNJtm2ITumAFGQwWmHXpoeSOWXBXjdTDpjSBBwqnHd4", + "mode": "list", + "cachedResultName": "Nomina Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LNJtm2ITumAFGQwWmHXpoeSOWXBXjdTDpjSBBwqnHd4/edit?usp=drivesdk" + }, + "changeFileContent": true, + "inputDataFieldName": "Nomina", + "options": {} + }, + "type": "n8n-nodes-base.googleDrive", + "typeVersion": 3, + "position": [ + -96, + 624 + ], + "id": "fb1eebd6-f171-460d-85e8-6f95206af3ea", + "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": "46715f4d-1922-4c92-8a89-9e28094f58d9", + "name": "HTTP Request", + "credentials": { + "googleDriveOAuth2Api": { + "id": "g23xdGLZRzBGqKgH", + "name": "Isaac - Google Drive" + } + } + }, + { + "parameters": { + "options": {} + }, + "type": "n8n-nodes-base.splitInBatches", + "typeVersion": 3, + "position": [ + 544, + 608 + ], + "id": "457257ac-1057-4294-8e64-81e47518252e", + "name": "Loop Over Items" + }, + { + "parameters": {}, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 1552, + 640 + ], + "id": "ed3d30a9-c8ad-4257-b35c-7ae387bc4ef0", + "name": "Wait", + "webhookId": "1e29dae8-b949-44b2-9dc8-a8e8ca037878" + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1LNJtm2ITumAFGQwWmHXpoeSOWXBXjdTDpjSBBwqnHd4", + "mode": "list", + "cachedResultName": "Nomina Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LNJtm2ITumAFGQwWmHXpoeSOWXBXjdTDpjSBBwqnHd4/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "={{ $json.sheetId }}", + "mode": "id" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 944, + 656 + ], + "id": "fb71e006-6ec3-4a9a-a275-5c0c2bc0cc06", + "name": "Get row(s) in sheet2", + "credentials": { + "googleSheetsOAuth2Api": { + "id": "K0hDZh3a85MpOHCs", + "name": "Google Sheets account 2" + } + } + }, + { + "parameters": { + "operation": "append", + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=1217920095" + }, + "columns": { + "mappingMode": "defineBelow", + "value": { + "Identidad": "={{ $json.Identidad }}" + }, + "matchingColumns": [ + "IGSS" + ], + "schema": [ + { + "id": "Identidad", + "displayName": "Identidad", + "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, + 640 + ], + "id": "32ffb373-d32b-4578-8eee-6637ae08359b", + "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": "e2c86bb4-1e51-431d-8f72-492bcf1679dc", + "name": "Code in JavaScript1" + }, + { + "parameters": { + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=1217920095" + }, + "options": {} + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1120, + 512 + ], + "id": "c4fa4012-5fe5-4096-9fc8-6db70bc32dec", + "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": "identidad", + "field2": "Identidad" + } + ] + }, + "joinMode": "keepNonMatches", + "outputDataFrom": "input1", + "options": {} + }, + "type": "n8n-nodes-base.merge", + "typeVersion": 3.2, + "position": [ + 1408, + 432 + ], + "id": "124866da-6498-4ead-a3c4-e897e8f1fddc", + "name": "Merge1" + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=1217920095" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 1504, + -16 + ], + "id": "f7db80f6-bc02-43d5-a3fa-dc74baa912cd", + "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": [ + 1664, + 432 + ], + "id": "dff83c05-e7b9-46dd-8bba-ccd11ee4b008", + "name": "Send a message1", + "webhookId": "14c6ce68-f411-4105-9880-268fdaef96db", + "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": "18e9e185-a3a8-42a9-bfe8-a920734d9ddb", + "name": "Update file1", + "credentials": { + "googleDriveOAuth2Api": { + "id": "g23xdGLZRzBGqKgH", + "name": "Isaac - Google Drive" + } + } + }, + { + "parameters": { + "operation": "clear", + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": 1217920095, + "mode": "list", + "cachedResultName": "Hoja 2", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit#gid=1217920095" + } + }, + "type": "n8n-nodes-base.googleSheets", + "typeVersion": 4.7, + "position": [ + 272, + 0 + ], + "id": "6297f3fb-1697-4702-84d1-f6d60d71c798", + "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": [ + 480, + 208 + ], + "id": "51c4dc85-ca9a-46d7-b65c-de63e530287d", + "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": "059c1c8b-99d9-479d-accc-9387581c72ef", + "name": "Edit Fields" + }, + { + "parameters": { + "operation": "append", + "documentId": { + "__rl": true, + "value": "1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM", + "mode": "list", + "cachedResultName": "TSS Honduras", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/edit?usp=drivesdk" + }, + "sheetName": { + "__rl": true, + "value": "gid=0", + "mode": "list", + "cachedResultName": "Hoja 1", + "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iSnio0z93IjHFLHzkgI03LKk3OVmFIQjw4HMHCWf-ZM/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": [ + 1120, + -16 + ], + "id": "5e044e50-f5e2-4905-91e9-1d4fd694f350", + "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": "3f2c18db-13a9-4b7c-a6b3-5b70ca664070", + "name": "Extract from File" + }, + { + "parameters": { + "jsCode": "const items = $input.all();\n\nlet identidades = [];\n\nfor (const item of items) {\n let text = String(item.json.text || '');\n text = text.replace(/\\r/g, '');\n\n // Quitar acentos para evitar problemas con AFILIACIÓN / IDENTIDAD\n const normalized = text\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n\n // En ESTE PDF, las identidades quedaron entre:\n // \"NO. AFILIACION\" ... \"IDENTIDAD\"\n const match = normalized.match(/NO\\.?\\s*AFILIACION([\\s\\S]*?)IDENTIDAD/i);\n if (!match) continue;\n\n const block = match[1];\n\n // Extraer solo números de 13 dígitos\n const encontrados = block.match(/\\b\\d{13}\\b/g) || [];\n\n identidades.push(...encontrados);\n}\n\n// Deduplicar\nidentidades = [...new Set(identidades)];\n\nreturn identidades.map(id => ({\n json: {\n identidad: id\n }\n}));" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 704, + 0 + ], + "id": "a8ff5615-66d7-41d8-a2b2-2c4d574f445d", + "name": "Code in JavaScript" + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "7712a83a-adff-4753-8503-935d71c7808a", + "name": "Identidad", + "value": "={{ $json['Identidad '] }}", + "type": "number" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 1072, + 656 + ], + "id": "dea3cc43-0ed8-4049-9bf4-a8a2f655cf70", + "name": "Edit Fields1", + "onError": "continueErrorOutput" + } + ], + "connections": { + "On form submission": { + "main": [ + [ + { + "node": "Clear sheet", + "type": "main", + "index": 0 + }, + { + "node": "Update file", + "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 51c1b554", + "description": "", + "autosaved": true, + "workflowPublishHistory": [ + { + "createdAt": "2026-06-30T15:41:15.359Z", + "id": 2070, + "workflowId": "HXEZPnVf1ALsLncE", + "versionId": "51c1b554-4884-4531-bae8-151d9d8fac60", + "event": "activated", + "userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029" + } + ] + } +} \ No newline at end of file