AutomationFlowsAI & RAG › Anonimizacao De CSV Remocao De Dados Pessoais

Anonimizacao De CSV Remocao De Dados Pessoais

60-Anonimizacao-De-Csv-Remocao-De-Dados-Pessoais. Uses googleDriveTrigger, googleDrive, openAi. Event-driven trigger; 10 nodes.

Event trigger★★★★☆ complexityAI-powered10 nodesGoogle Drive TriggerGoogle DriveOpenAI
AI & RAG Trigger: Event Nodes: 10 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Google Drive → Google Drive Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "ff4e8706-09a0-4bf1-86c1-dfb65f55ccb3",
      "name": "Google Drive Trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        20,
        -140
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1-hRMnBRYgY6iVJ_youKMyPz83k9GAVYu",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1-hRMnBRYgY6iVJ_youKMyPz83k9GAVYu",
          "cachedResultName": "nnnnnnnnnnn8n"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "340fb03b-3b8a-4eb4-ad4c-b0ba12b72b19",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        260,
        -140
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {
          "binaryPropertyName": "data"
        },
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "4a5d037f-0103-4645-87d0-785dfdfb80d1",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        260,
        60
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "36c7e83d-f22f-4a71-b5a2-64ed3e4ce24b",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -120,
        260
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "Analise os dados tabulares fornecidos e identifique as colunas que cont\u00eam informa\u00e7\u00f5es pessoalmente identific\u00e1veis (PII). Retorne apenas os nomes das colunas que cont\u00eam PII, separados por v\u00edrgulas. Nome da chave: 'content'. N\u00e3o inclua nenhum texto ou explica\u00e7\u00e3o adicional."
            },
            {
              "content": "=Aqui est\u00e3o alguns dados tabulares com cabe\u00e7alhos de coluna e duas linhas de exemplo.\n\nCabe\u00e7alhos: {{Object.keys($json)}}\n\nLinha de exemplo 1: {{Object.values($json)}}\n\n"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.7
    },
    {
      "id": "771c6535-47d4-4c70-b487-bd5ac602e29c",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        440,
        260
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3
    },
    {
      "id": "1fc467fd-379d-4841-978b-89c1453b61d8",
      "name": "Upload to Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        740,
        260
      ],
      "parameters": {
        "name": "={{ $json.fileName }}",
        "content": "={{ $json.content }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1F30Qu3csrmMhtcu_prMipeiGm-64VEdd",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1F30Qu3csrmMhtcu_prMipeiGm-64VEdd",
          "cachedResultName": "processed"
        },
        "operation": "createFromText"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "92715586-e630-4584-83a3-1af42d7cb50e",
      "name": "Get filename",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        20,
        60
      ],
      "parameters": {
        "options": {
          "destinationFieldName": "originalFilename"
        },
        "fieldToSplitOut": "name"
      },
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "2c4b3242-34db-4948-b835-cd2340ad7b19",
      "name": "Get result",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        200,
        260
      ],
      "parameters": {
        "options": {
          "destinationFieldName": "data"
        },
        "fieldToSplitOut": "message.content.content"
      },
      "typeVersion": 1
    },
    {
      "id": "4207dc71-5b0e-4780-9f23-00f5a7fc3862",
      "name": "Remove PII columns",
      "type": "n8n-nodes-base.code",
      "position": [
        580,
        260
      ],
      "parameters": {
        "jsCode": "// Entrada: todos os itens do n\u00f3 anterior\nconst input = $input.all();\n\n// Passo 1: extrair os nomes das colunas com PII do primeiro item\nconst firstItem = input[0];\nif (!firstItem.json.data || !firstItem.json.data) {\n throw new Error(\"Nomes das colunas com PII ausentes nos dados de entrada.\");\n}\nconst piiColumns = firstItem.json.data.split(',').map(col => col.trim());\n//console.log(\"Colunas com PII a remover:\", piiColumns);\n\n// Passo 2: remover os dois primeiros itens e processar as linhas restantes\nlet rows = input.slice(2).map(item => item.json); // Exclui o primeiro item\n//console.log(\"Linhas a converter (antes de pular a \u00faltima):\", rows);\n\n\n// Garante que h\u00e1 linhas para processar\nif (rows.length === 0) {\n throw new Error(\"Nenhuma linha para converter em CSV.\");\n}\n\n// Passo 3: remover colunas com PII de cada linha\nconst sanitizedRows = rows.map(row => {\n const sanitizedRow = { ...row }; // Copia a linha\n piiColumns.forEach(column => delete sanitizedRow[column]); // Remove colunas com PII\n return sanitizedRow;\n});\n//console.log(\"Linhas sanitizadas:\", sanitizedRows);\n\n// Passo 4: extrair cabe\u00e7alhos das linhas sanitizadas\nconst headers = Object.keys(sanitizedRows[0]); // Extrai cabe\u00e7alhos atualizados\n//console.log(\"Cabe\u00e7alhos CSV:\", headers);\n\n// Passo 5: converter linhas para formato CSV\nconst csvRows = [\n headers.join(','), // Adiciona a linha de cabe\u00e7alho\n ...sanitizedRows.map(row => \n headers.map(header => String(row[header] || '').replace(/,/g, '')).join(',') // Combina cabe\u00e7alhos com linhas\n )\n];\n\n// Junta todas as linhas com uma quebra de linha\nconst csvContent = csvRows.join('\\n');\n//console.log(\"Conte\u00fado CSV:\", csvContent);\n\nconst originalFileName = input[1].json.originalFilename;\n\n// Passo 7: gerar um novo nome de arquivo\nconst fileExtension = originalFileName.split('.').pop();\nconst baseName = originalFileName.replace(`.${fileExtension}`, '');\nconst newFileName = `${baseName}_PII_removed.${fileExtension}`;\n//console.log(\"Novo nome do arquivo:\", newFileName);\n\n// Passo 8: retornar o conte\u00fado CSV e o nome do arquivo como JSON\nreturn [\n {\n json: {\n fileName: newFileName, // Novo nome de arquivo\n content: csvContent // Conte\u00fado CSV como texto puro\n }\n }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "e9f25ee7-cd00-4496-9062-5d57cab5788d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        -220
      ],
      "parameters": {
        "height": 260,
        "content": "## Remover PII de Arquivos CSV\nEste fluxo monitora uma pasta do Google Drive em busca de novos arquivos CSV, identifica e remove colunas com PII usando a OpenAI e faz upload do arquivo sanitizado de volta para o Drive. Requer as integra\u00e7\u00f5es de Google Drive e OpenAI com acesso \u00e0 API habilitado."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Remove PII columns",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Get result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get result": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get filename": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Drive": {
      "main": [
        []
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Remove PII columns": {
      "main": [
        [
          {
            "node": "Upload to Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Get filename",
            "type": "main",
            "index": 0
          },
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

60-Anonimizacao-De-Csv-Remocao-De-Dados-Pessoais. Uses googleDriveTrigger, googleDrive, openAi. Event-driven trigger; 10 nodes.

Source: https://github.com/mascenaa/AutoPronto/blob/d3dafe08d296506b85c3bd29aba5d98df9c9906a/pacotes/kit-completo/60-anonimizacao-de-csv-remocao-de-dados-pessoais.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

The Problem That it Solves

Google Drive Trigger, OpenAI, Google Drive +5
AI & RAG

Content creators, YouTubers, and social media managers who want to repurpose long form videos into short clips without doing it manually. Works on self hosted n8n instances.

Google Drive Trigger, Google Drive, N8N Nodes Renderio +3
AI & RAG

This workflow automatically turns any audio file uploaded to Google Drive into a complete podcast episode. It handles transcription, content generation, blog drafting, social copy creation, thumbnail

Google Drive Trigger, Google Drive, OpenAI +3
AI & RAG

End-to-end pipeline: Watch Drive ➜ Download PDF ➜ OCR text ➜ AI normalize to JSON ➜ Upsert Buyer (Account) ➜ Create Opportunity ➜ Map Products ➜ Create OLI via Composite API ➜ Archive to OneDrive. Pur

Google Drive Trigger, OpenAI, Google Drive +3
AI & RAG

This workflow is designed for teams and businesses that receive invoices in Google Drive and want to automatically extract structured financial data without manual processing. It is ideal for finance

Telegram Trigger, Google Drive Trigger, Google Drive +3