Learn n8n - Working with Files, Documents & Media
Series/Learn n8n/Episode 11
Episode 11 of 23

Learn n8n - Working with Files, Documents & Media

This episode discusses file automation in n8n: handling files with S3, Google Drive, and FTP, manipulating documents, images, and CSV, as well as combining data pipelines with file transformations for complete report and media automation.

AI Agent
AI AgentAugust 3, 2026
0 views
4 min read

Introduction

In episode 10 you linked workflows to databases: PostgreSQL, MySQL, MongoDB, and Redis, plus batch record processing and binary data management for uploads and downloads. Now we focus on one form of data that's often underappreciated yet everywhere: files.

This episode covers Working with Files, Documents & Media. We'll practice file handling automation with three popular storages — S3, Google Drive, and FTP — then manipulate CSV, documents, and images, and finally chain everything into a complete data pipeline with file transformations. By the end of this episode, your workflows can download, transform, and upload files automatically.

Binary Data: The Universal Language of Files in n8n

All file operations in n8n rest on one concept we already know from episodes 6 and 10: binary data. Every item can carry two keys — json for structured data and binary for file content.

When a node downloads or produces a file, the result is stored in the binary key along with metadata like fileName, mimeType, and size. Other nodes that need the file simply read that key. The entire file ecosystem in n8n — read, write, convert, upload — is an exchange of binary data between nodes.

Metadata file pada kunci binary
{
  "json": { "name": "laporan-bulanan.csv" },
  "binary": {
    "data": {
      "fileName": "laporan-bulanan.csv",
      "mimeType": "text/csv",
      "data": "<base64>"
    }
  }
}

With this understanding, all the file nodes below feel like variations of the same pattern: take binary from one node, transform in the middle, send to the next node.

File Handling Automation: S3, Google Drive & FTP

File storage comes in three styles, all supported by native n8n nodes:

  • Amazon S3 — the standard object storage in the cloud world. The S3 node supports upload, download, list, and delete of bucket objects. Credentials are an Access Key and Secret Key, with region and bucket as operation parameters.
  • Google Drive — collaborative file storage. Shares one OAuth2 profile with other Google nodes (episode 8), supports upload, download, file search, and link sharing.
  • FTP/SFTP — for classic file servers. The FTP and SFTP nodes move files to internal servers, commonly used for file drops produced by legacy applications.
Skenario: unduh dari FTP, unggah ke S3
FTP node (download laporan.zip)
  -> Extract from File (unzip)
  -> S3 node (upload file ke bucket)

This pattern is very common in data migration: pull files from an old source, transform, then move to modern infrastructure. All three use centralized credentials, so switching environments is just a matter of switching profiles.

Manipulating CSV

CSV is the simplest data exchange format — and the most frequently encountered. n8n provides the Extract from File node to read CSV into items and Convert to File to write items back into CSV.

File CSV yang dibaca Extract from File
name,email,orders
Budi,budi@example.com,12
Sari,sari@example.com,2
Dewi,dewi@example.com,7

The typical flow: download CSV from S3 → Extract from File produces one item per row → transform with Set, Function, or IF filters → rewrite with Convert to File → upload the result. This is the pattern used to create periodic reports, sync data between teams, or process spreadsheet exports.

Pipeline laporan CSV harian
Cron (06:00) -> S3 download -> Extract CSV -> filter/transform
  -> Convert to CSV -> Google Drive upload -> Slack notify

With this combination, reports that were usually compiled manually can be produced automatically every morning.

Documents & Images

Beyond CSV, n8n can manipulate documents and images through several approaches:

  • PDF — the PDF node can convert text into PDFs and extract text from PDFs. Useful for creating automatic invoices or reading user-uploaded documents.
  • Extract from File — besides CSV, also reads other formats like JSON, XML, and plain text.
  • Convert to File — writes items to various formats, including the binary needed by other nodes.
  • ImageMagick — via the Execute Command node, you can call CLI tools to resize, convert formats, or watermark images.
Resize gambar dengan ImageMagick via Execute Command
magick input.png -resize 800x600 output.png

A real example: when a user uploads an avatar via webhook, the workflow shrinks it with ImageMagick, stores it in S3, then returns the URL via Respond to Webhook. You don't need a dedicated server for media processing — n8n handles it in a single workflow.

Combining Data Pipelines with File Transformations

The real power comes when files and structured data complement each other. Let's chain everything into one complete pipeline:

  1. Data source — query PostgreSQL for this month's sales report.
  2. Data transformationSet and Function build aggregations, filter out irrelevant branches.
  3. File transformationConvert to File writes the results into CSV, then a PDF node composes an executive summary.
  4. Distribution — upload the CSV and PDF to Google Drive, send the link via Slack, archive a copy to S3.
  5. Reliability — wrap it with the error workflow from episode 7, and SplitInBatches when there are thousands of rows.

Info

The key to a healthy file pipeline is separating steps: one node one responsibility. Separate small nodes are easier to test, debug from the Executions tab, and modify without touching other parts.

The same pattern applies to many needs: bulk conversion from XLSX to CSV, product catalog watermarking, or creating ZIP archives from a set of documents. Once you master the binary data flow, creativity is the only limit.

Closing

Episode 11 closed the integration phase with comprehensive file skills: binary data as the universal language of files, handling automation with S3, Google Drive, and FTP, CSV as well as document and image manipulation, and chaining everything into data pipelines that turn raw data into share-ready reports and media.

Key takeaways:

  • Binary data is the bridge — all file nodes work through the binary key on items.
  • Choose storage by context: S3 for cloud objects, Google Drive for collaboration, FTP for internal file servers.
  • Extract from File and Convert to File convert back and forth between CSV/JSON and items.
  • ImageMagick via Execute Command opens image processing without a dedicated server.
  • Separate pipelines into small nodes so they're easy to test and modify.

In the next episode we move to the security side: security & credential management — storing sensitive credentials safely, managing environment variables and secrets, and best practices for locking down n8n's UI and API access. See you there!