Skip to main content

Automatically save & organize LINE message files in Google Drive with Sheets logging

Workflow preview

Workflow preview
100%
Automatically save & organize LINE message files in Google Drive with Sheets logging preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Overview This workflow automatically saves files received via LINE Messaging API into Google Drive and logs the file details into a Google Sheet. It checks the file type against allowed types, orga...

Best for

  • File Management automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.googlesheets, n8n-nodes-base.googledrive, n8n-nodes-base.code, n8n-nodes-base.merge, n8n-nodes-base.if, n8n-nodes-base.httprequest, n8n-nodes-base.webhook, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Jaruphat J..

Original n8n.io source

1.1 Workflow description

Title
Automatically save & organize LINE message files in Google Drive with Sheets logging
Workflow name
Automatically save & organize LINE message files in Google Drive with Sheets logging

Overview

This workflow automatically saves files received via LINE Messaging API into Google Drive and logs the file details into a Google Sheet. It checks the file type against allowed types, organizes files into date-based folders and (optionally) file type–specific subfolders, and sends a reply message back to the LINE user with the file URL or an error message if the file type is not permitted.

Who is this for?

Developers & IT Administrators: Looking to integrate LINE with Google Drive and Sheets for automated file management. Businesses & Marketing Teams: That want to automatically archive media files and documents received from users via LINE. Anyone Interested in No-Code Automation: Users who want to leverage n8n’s capabilities without heavy coding.

What Problem Does This Workflow Solve?

Automated File Organization: Files received from LINE are automatically checked for allowed file types, then stored in a structured folder hierarchy in Google Drive (by date and/or file type). Data Logging: Each file upload is recorded in a Google Sheet, providing an audit trail with file names, upload dates, URLs, and types. Instant Feedback: Users receive an immediate reply via LINE confirming the file upload, or an error message if the file type is not allowed.

What This Workflow Does

1. Receives Incoming Requests:

  • A webhook node ("LINE Webhook Listener") listens for POST requests from LINE, capturing file upload events and associated metadata.

2. Configuration Loading:

  • A Google Sheets node ("Get Config") reads configuration data (e.g., parent folder ID, allowed file types, folder organization settings, and credentials) from a pre-defined sheet.

Data Merging & Processing:

  • The "Merge Event and Config Data" and "Process Event and Config Data" nodes merge and structure the event data with configuration settings.
  • A "Determine Folder Info" node calculates folder names based on the configuration. If Store by Date is enabled, it uses the current date (or a specified date) as the folder name. If Store by File Type is also enabled, it uses the file’s type (e.g., image) for a subfolder.

4. Folder Search & Creation:

  • The workflow searches for an existing date folder ("Search Date Folder").
  • If the date folder is not found, an IF node ("Check Existing Date Folder") routes to a "Create Date Folder" node.
  • Similarly, for file type organization, the workflow uses a "Search FileType Folder" node (with appropriate conditions) to look for a subfolder, or creates it if not found.
  • The "Set Date Folder ID" and "Set Image Folder ID" nodes capture and merge the resulting folder IDs.
  • Finally, the "Config final ParentId" node sets the final target folder ID based on the configuration conditions:
    • Store by Date: TRUE, Store by File Type: TRUE: Use the file type folder (inside the date folder).
    • Store by Date: TRUE, Store by File Type: FALSE: Use the date folder.
    • Store by Date: FALSE, Store by File Type: TRUE: Use the file type folder.
    • Store by Date: FALSE, Store by File Type: FALSE: Use the Parent Folder ID from the configuration.

5. File Retrieval and Validation:

  • A HTTP Request node ("Get File Binary Content") fetches the file’s binary data from the LINE API.
  • A Function node ("Validate File Type") checks if the file’s MIME type is included in the allowed list (e.g., "audio|image|video"). If not, it throws an error that is captured for the reply.

6. File Upload and Logging:

  • The "Upload File to Google Drive" node uploads the validated binary file to the final target folder.
  • After a successful upload, the "Log File Details to Google Sheet" node logs details such as file name, upload date, Google Drive URL, and file type into a designated Google Sheet.

7. User Feedback:

  • The "Check Reply Enabled Flag" node checks if the reply feature is enabled.
  • Finally, the "Send LINE Reply Message" node sends a reply message back to the LINE user with either the file URL (if the upload was successful) or an error message (if the file type was not allowed).

Setup Instructions

1. Google Sheets Setup:

  • Create a Google Sheet with two sheets:
    • config: Include columns for Parent Folder Path, Parent Folder ID, Store by Date (boolean), Store by File Type (boolean), Allow File Types (e.g., “audio|image|video”), CurrentDate, Reply Enabled, and CHANNEL ACCESS TOKEN.
    • fileList: Create headers for File Name, Date Uploaded, Google Drive URL, and File Type.

For an example of the required format, check this Google Sheets template: Google Sheet Template

2. Google Drive Credentials:

  • Set up and authorize your Google Drive credentials in n8n.

3. LINE Messaging API:

  • Configure your LINE Developer Console webhook to point to the n8n Webhook URL ("Line Chat Bot" node).
  • Ensure you have the proper Channel Access Token stored in your Google Sheet.

4. n8n Workflow Import:

  • Import the provided JSON file into your n8n instance.
  • Verify node connections and update any credential references as needed.

5. Test the Workflow:

  • Send a test message via LINE to confirm that files are properly validated, uploaded, logged, and that reply messages are sent.

How to Customize This Workflow

  • Allowed File Types: Adjust the "Validate File Type" field in your config sheet to control which file types are accepted.
  • Folder Structure: Modify the logic in the "Determine Folder Info" and subsequent folder nodes to change how folders are structured (e.g., use different date formats or add additional categorization).
  • Logging: Update the "Log File Details to Google Sheet" node if you wish to log additional file metadata.
  • Reply Messages: Customize the reply text in the "Send LINE Reply Message" node to include more detailed information or instructions.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Get Config

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 2

Block 2 - Create Date Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 2

Block 3 - Set Date Folder ID

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - Create File Type Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 5 - Upload File to Google Drive

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 6 - Determine Folder Info

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - Search Date Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 8 - Merge Event and Config Data

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 1

Block 9 - Check Existing Date Folder

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 10 - Check Existing File Type Folder

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 11 - Merge Final Parent Folder Data

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 1

Block 12 - Search File Type Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 13 - Set File Type Folder ID

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 14 - Configure Final Parent Folder ID

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 15 - Process Event and Config Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - Get File Binary Content

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 17 - Log File Details to Google Sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 18 - Check Reply Enabled Flag

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 19 - Check if Store by Date is Enabled

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 20 - Check if Store by File Type is Enabled

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 21 - LINE Webhook Listener

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 1

Block 22 - Send LINE Reply Message

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 23 - Validate File Type

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 24 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 27 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Automatically save & organize LINE message files in Google Drive with Sheets logging
Complexity advanced
Nodes 27
Categories File Management
Author Jaruphat J.
Published 17 Mar 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3191/3191.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automatically save & organize LINE message files in Google Drive with Sheets logging do?

Overview This workflow automatically saves files received via LINE Messaging API into Google Drive and logs the file details into a Google Sheet. It checks the file type against allowed types, orga...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your File Management use case.