Achieve seamless data synchronization using this robust n8n workflow. Bi-directionally sync Excel or Google Sheets data with a Postgres database using the powerful n8n node framework and upsert logic.
Download this n8n workflow template and start using it instantly.
Maintaining consistency between frequently updated spreadsheets and a centralized database can be challenging. This powerful n8n workflow solves this by providing a reliable synchronization pipeline. It allows users to read tables from Microsoft Excel (or Google Sheets, using similar connectivity) and perform an intelligent upsert (update or insert) operation into a PostgreSQL database. A critical feature of this n8n template is the inclusion of a custom Code n8n node designed specifically to handle tricky Excel date serial numbers, ensuring data integrity before insertion. By utilizing multiple n8n trigger options, this n8n workflow offers flexibility for manual, scheduled, or execution-based synchronization, making it a highly adaptable solution for any data-driven operation.
This n8n workflow is initiated by one of three separate n8n trigger nodes, providing maximum deployment flexibility:
Click Sync Excel -> DB n8n trigger (Manual Trigger), executed on a recurring basis via the Schedule Sync Excel -> DB n8n trigger (Schedule Trigger), or called as a sub-workflow using the Exec Sync Excel -> DB n8n trigger (Execute Workflow Trigger).Get Table Microsoft Excel n8n node. This n8n node connects to the specified workbook and worksheet (configured to 'CLIENTS' in this template) and retrieves up to 200 rows of data.Sanitize Date Code n8n node. This custom script is essential because Excel often stores dates as serial numbers (counting days since December 30, 1899). The n8n code node detects if the date field is a number or a string, converts it into a standard JavaScript Date object, and then formats it uniformly as MM/DD/YYYY.Upsert Table Postgres n8n node. This n8n node performs an 'upsert' operation on the target 'clients' table. It uses the no column as the matching identifier (primary key). If a row with a matching no exists, it updates the row; otherwise, it inserts a new row. This ensures that the Postgres database remains a perfectly synchronized mirror of the Excel sheet, thanks to this robust n8n workflow.To deploy this comprehensive n8n workflow, follow these steps:
Get Table Microsoft Excel n8n node. You must set up or select OAuth2 credentials to grant n8n access to your Excel Online or OneDrive files. Ensure the correct Workbook and Worksheet names are selected.Upsert Table Postgres n8n node. You will need to create or select a credential set providing the necessary connection details (host, database name, user, password) for your PostgreSQL instance.clients). The Postgres n8n node is configured for 'autoMapInputData' for convenience.Click Sync Excel -> DB) and execute the n8n workflow to test the synchronization. Click Sync Excel -> DB (Manual Trigger): Serves as an immediate, manual starting point for the n8n workflow, allowing on-demand data synchronization.
Schedule Sync Excel -> DB (Schedule Trigger): This powerful n8n trigger allows the automation to run automatically at predetermined intervals (e.g., hourly, daily) to ensure continuous synchronization.
Get Table (Microsoft Excel n8n node): Connects to Microsoft Excel/OneDrive to fetch data. It is configured to pull all rows (up to the defined limit) from the 'CLIENTS' worksheet, initiating the data flow of this n8n template.
Sanitize Date (Code n8n node): A critical custom Code n8n node. Its function is to convert complex date formats, specifically handling Excel's numerical date serialization (days since 1899) and various date string formats, normalizing them to MM/DD/YYYY for consistent database storage.
no column to match records. This ensures that the n8n workflow efficiently updates existing database entries instead of creating duplicates, vital for robust data synchronization.Automate two-way sync between KlickTipp and Google Calendar using this advanced n8n workflow. Capture RSVP status, update contacts, and automatically send invitations.

Use this dynamic n8n workflow to automatically sync GitHub issue events (opened, edited, closed, deleted) directly to a centralized Notion database, maintaining real-time parity for project tracking.

Use this robust n8n workflow to automatically sync time entries from Clockify to Syncro MSP tickets, preventing duplicates using a Google Sheets lookup table. Perfect for IT service providers using n8n templates.

Use this advanced n8n workflow to monitor Google Drive, extract structured data using AI Agents (Azure OpenAI), update Google Sheets, and build a Pinecone vector knowledge base.

Use this powerful n8n workflow to automatically synchronize data between Google Sheets and a PostgreSQL database hourly. This n8n template ensures data integrity and efficiency.

Experienced Operations and Workflow Manager with a Master’s degree in Electronics and Software Development. I specialize in designing and implementing efficient, automated systems that help teams save time, reduce errors, and scale with confidence. My expertise spans across business process optimization, automation platforms, and custom workflow solutions. Looking to streamline your operations? Book a consultation with me to explore tailored automation strategies and n8n-powered workflows.







































