Smart automation of Gmail & Drive based on n8n (Self-hosted)
Developed a highly efficient script in n8n for automatically sorting email attachments directly to Google Drive. Unlike simple solutions, this automation uses custom JavaScript code to process dates and flexible logic to check for the existence of folders.
Technical features and logic (Workflow):
Intelligent sorting: The system automatically determines the year and month of the received email and checks for the corresponding folder on Google Drive. If the folder does not exist, it is created automatically.
Flexibility in data processing: Two methods of file uploading have been implemented for different loading scenarios:
-batch upload: Simultaneous processing of all email attachments for maximum speed.
-cyclic upload (Loop): Sequential processing of files through Split Out and Loop Over Items nodes, ensuring stability when working with a large number of attachments or large files.
My technical stack in the project:
Platform: n8n (installed locally via Docker).
Integrations: Gmail API, Google Drive API (configured through Google Cloud Console API).
Tools: JavaScript (Node.js), loop operators, conditional logic (IF nodes), stream merging (Merge).
Result: The client received a standalone system that does not require monthly subscription payments (like in Make/Zapier), as it operates on its own server, and ensures complete order in documentation without any human intervention.
A similar project was implemented using make.com and Google Apps Script.
#N8N #n8n.io #Automation #workflow #Gmail #GoogleAppsScript #Automation #automatisation #docker
Technical features and logic (Workflow):
Intelligent sorting: The system automatically determines the year and month of the received email and checks for the corresponding folder on Google Drive. If the folder does not exist, it is created automatically.
Flexibility in data processing: Two methods of file uploading have been implemented for different loading scenarios:
-batch upload: Simultaneous processing of all email attachments for maximum speed.
-cyclic upload (Loop): Sequential processing of files through Split Out and Loop Over Items nodes, ensuring stability when working with a large number of attachments or large files.
My technical stack in the project:
Platform: n8n (installed locally via Docker).
Integrations: Gmail API, Google Drive API (configured through Google Cloud Console API).
Tools: JavaScript (Node.js), loop operators, conditional logic (IF nodes), stream merging (Merge).
Result: The client received a standalone system that does not require monthly subscription payments (like in Make/Zapier), as it operates on its own server, and ensures complete order in documentation without any human intervention.
A similar project was implemented using make.com and Google Apps Script.
#N8N #n8n.io #Automation #workflow #Gmail #GoogleAppsScript #Automation #automatisation #docker