Cargador de archivos de Google Drive
Este es unBuilding Blocksflujo de automatización del dominio deautomatización que contiene 8 nodos.Utiliza principalmente nodos como Set, Code, GoogleDocs, GoogleDrive, ExecuteWorkflowTrigger. Cargar y agregar archivos desde una carpeta de Google Drive a un diccionario de clave-valor
- •Credenciales de API de Google Drive
Nodos utilizados (8)
Categoría
{
"name": "Google Drive Files Loader",
"nodes": [
{
"id": "3d066626-a87d-4e7b-bc16-9f47e1277dde",
"name": "Cuando se ejecuta por otro flujo de trabajo",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
0,
0
],
"parameters": {
"inputSource": "jsonExample",
"jsonExample": "{\n}"
},
"typeVersion": 1.1
},
{
"id": "cb0e5563-1550-4121-9fd5-b1cbd9810476",
"name": "Código",
"type": "n8n-nodes-base.code",
"position": [
960,
0
],
"parameters": {
"jsCode": "// n8n Code Node\n\n// Initialize an empty object to store the aggregated results\nconst aggregatedDict = {};\n\n// Get all input items passed to this node\nconst inputItems = $input.all();\n\n// Loop through each input item\nfor (const item of inputItems) {\n // Get the JSON data from the current item\n const itemJson = item.json;\n\n // Check if item.json is actually an object and not null/undefined\n // Also ensure it's not an array, as we expect key-value pairs\n if (itemJson && typeof itemJson === 'object' && !Array.isArray(itemJson)) {\n\n // Iterate over all the keys within the current item's JSON object\n for (const key of Object.keys(itemJson)) {\n // Add/overwrite the key-value pair to our aggregated dictionary\n aggregatedDict[key] = itemJson[key].replaceAll(/\\n+/g, \"\\n\");\n // console.log(`Adding/Updating key: ${key}`); // Optional: for debugging\n }\n\n } else {\n // Optional: Log a warning if an item doesn't have the expected format\n console.warn(`Skipping item - 'json' property is not a valid object:`, itemJson);\n }\n}\n\n// n8n expects an array of items as output.\n// We return a single item containing the final aggregated dictionary in its 'json' property.\nreturn [{ json: aggregatedDict }];"
},
"typeVersion": 2
},
{
"id": "1b90ca95-7251-4573-9b0b-4af3622721ba",
"name": "Nota adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
140,
-140
],
"parameters": {
"height": 300,
"content": "## Step1\nDefine folder you want to search all files in."
},
"typeVersion": 1
},
{
"id": "d26c2f27-0095-4dd6-9aa5-94c68f58bda3",
"name": "Obtener archivos de carpeta",
"type": "n8n-nodes-base.googleDrive",
"position": [
220,
0
],
"parameters": {
"filter": {
"folderId": {
"mode": "list",
"value": "root",
"cachedResultName": "/ (Root folder)"
}
},
"options": {},
"resource": "fileFolder"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "Ng83G9mU8KtY3wu6",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "938c8f7c-84b1-4eeb-a7c8-894ae5fbc275",
"name": "Descargar Google Docs",
"type": "n8n-nodes-base.googleDocs",
"position": [
500,
0
],
"parameters": {
"operation": "get",
"documentURL": "={{ $json.id }}"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "bbAywBJpCuYeRX89",
"name": "Google Docs account"
}
},
"typeVersion": 2
},
{
"id": "caa075a2-2e85-47e5-a829-425a1177e5be",
"name": "Nota adhesiva1",
"type": "n8n-nodes-base.stickyNote",
"position": [
420,
-140
],
"parameters": {
"height": 300,
"content": "## Step2\nIf you have files other than google docs change node here."
},
"typeVersion": 1
},
{
"id": "05db5439-584e-40aa-9c1d-101618f66fdc",
"name": "Mapeo",
"type": "n8n-nodes-base.set",
"position": [
780,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b33e9355-659a-4b71-ba5c-00c90b7ed792",
"name": "={{ $('Get files from folder').item.json.name }}",
"type": "string",
"value": "={{ $json.content }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "85dc7e65-7d50-4b13-b114-88b4020865e8",
"name": "Nota adhesiva2",
"type": "n8n-nodes-base.stickyNote",
"position": [
720,
-140
],
"parameters": {
"color": 3,
"width": 400,
"height": 300,
"content": "## Mapping\nThis mapping part will output a dictionary with key:value where key if file name and value is file content"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"05db5439-584e-40aa-9c1d-101618f66fdc": {
"main": [
[
{
"node": "cb0e5563-1550-4121-9fd5-b1cbd9810476",
"type": "main",
"index": 0
}
]
]
},
"938c8f7c-84b1-4eeb-a7c8-894ae5fbc275": {
"main": [
[
{
"node": "05db5439-584e-40aa-9c1d-101618f66fdc",
"type": "main",
"index": 0
}
]
]
},
"d26c2f27-0095-4dd6-9aa5-94c68f58bda3": {
"main": [
[
{
"node": "938c8f7c-84b1-4eeb-a7c8-894ae5fbc275",
"type": "main",
"index": 0
}
]
]
},
"3d066626-a87d-4e7b-bc16-9f47e1277dde": {
"main": [
[
{
"node": "d26c2f27-0095-4dd6-9aa5-94c68f58bda3",
"type": "main",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Intermedio - Bloques de construcción
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
Compartir este flujo de trabajo