This workflow automatically compares internal cash balances with custodian or bank balances using Google Sheets, detects mismatches by account_id, calculates balance differences, logs matched records and sends mismatched records through OpenAI for a short explanation before saving them for exception review. It is designed to help teams reduce manual reconciliation work and quickly identify balance issues.
account_id values.internal_balancecustodian_balanceThe Cash Reconciliation Checker automates a common finance operations task: comparing balances between two separate data sources. In this workflow, one Google Sheet holds internal balances, while another holds custodian balances. The workflow fetches both datasets, standardizes the required fields and matches records using the shared account_id.
After matching the accounts, the workflow calculates the difference between internal and custodian balances and checks whether the difference exceeds a built-in tolerance. If the balances match, the record is written to a reconciliation log as a successful result. If they do not match, the workflow routes the record into an exception path.
For mismatches, the workflow uses OpenAI (gpt-4o-mini) to generate a short possible explanation based on the values in the record. That enriched mismatch record is then prepared and appended to a separate logging sheet for investigation and follow-up.
This workflow is useful for teams and professionals who regularly compare balances across systems, such as:
It is especially useful for organizations that currently reconcile balances manually in spreadsheets and want a faster, more consistent process.
Before using this workflow, make sure you have the following:
You will need to configure:
This workflow expects the following source data structure based on the JSON:
Must contain at least:
account_idcurrencyinternal_balanceMust contain at least:
account_idcurrencycustodian_balanceShould support these columns:
account_idcurrencyinternal_balancecustodian_balancedifferenceabs_differencemismatchchecked_atrecon_statusShould support these columns:
account_idcurrencyinternal_balancecustodian_balancedifferenceabs_differencemismatchchecked_atai_explanationrecon_statusTo avoid processing issues:
account_id should be consistent across both source sheetscurrency should be present where relevantImport the provided JSON file into your n8n workspace.
After import, you will see the workflow named:
Cash Reconciliation Checker
The workflow follows this sequence:
Schedule Trigger
β Fetch Internal Balances
β Fetch Custodian Balances
β Edit Internal Fields / Edit Custodian Fields
β Match Accounts by Account ID
β Calculate Balance Difference
β Check for Balance Mismatch
βββ Matched β Log Matched Records
βββ Mismatched β Generate AI Mismatch Explanation β Prepare Exception Record β Append The Data In The Sheet
Run Reconciliation on Schedule
This node starts the workflow automatically using a schedule interval.
Use a timing pattern that fits your reconciliation process.
Fetch Internal Balances
This Google Sheets node pulls records from the internal balance sheet.
account_idcurrencyinternal_balanceFetch Custodian Balances
This Google Sheets node pulls records from the custodian or bank balance sheet.
account_idcurrencycustodian_balanceThe workflow uses two Set nodes to clean and normalize fields before matching.
Edit Internal Fields
This node maps and formats:
account_idcurrencyinternal_balanceIt also converts internal_balance into a numeric value.
Edit Custodian Fields
This node maps and formats:
account_idcurrencycustodian_balanceIt also converts custodian_balance into a numeric value.
This step helps ensure both datasets use a consistent field structure before comparison.
Match Accounts by Account ID
This Merge node combines both sources using:
account_id
It aligns internal and custodian records so each account can be compared side by side.
This will only work properly if:
account_id valuesCalculate Balance Difference
This Code node performs the main reconciliation logic.
For each matched account, it creates:
internal_balancecustodian_balancedifferenceabs_differencemismatchchecked_atThe workflow uses a built-in tolerance:
const TOLERANCE = 0.01;
A record is treated as a mismatch if:
0.01account_idcurrencyinternal_balancecustodian_balancedifferenceabs_differencemismatchchecked_atThis is the core decision-making step in the workflow.
Check for Balance Mismatch
This IF node checks:
mismatch == true
mismatch = falseThe record is considered matched and goes to:
Log Matched Recordsmismatch = trueThe record is treated as an exception and goes to:
Generate AI Mismatch ExplanationThis split keeps normal reconciliations separate from exception handling.
Log Matched Records
This Google Sheets node appends matched records to a reconciliation log sheet.
account_idcurrencyinternal_balancecustodian_balancedifferenceabs_differencemismatchchecked_atrecon_statusMatched records are saved with:
recon_status = Matched
This gives you a clean audit trail of successfully reconciled accounts.
Generate AI Mismatch Explanation
This node sends mismatch data to OpenAI (gpt-4o-mini) and asks for a short explanation.
The AI is instructed to review:
It is then asked to provide the most likely cause of the mismatch from the following categories already defined in the workflow:
It also ends with:
This adds context to exceptions and helps operations teams review mismatches faster.
Prepare Exception Record
This Code node combines the AI output with the original mismatch data and formats it for logging.
account_idcurrencyinternal_balancecustodian_balancedifferenceabs_differencemismatchchecked_atai_explanationrecon_statusMismatch records are saved with:
recon_status = Mismatch
This creates a structured exception record ready for reporting or review.
Append The Data In The Sheet
This Google Sheets node appends the prepared mismatch records into a separate sheet for follow-up.
account_idcurrencyinternal_balancecustodian_balancedifferenceabs_differencemismatchchecked_atai_explanationrecon_statusThis acts as your exception register for unresolved or suspicious balance breaks.
Before enabling the workflow, run a few controlled tests.
Use the same values in both sheets for one account.
Expected result:
Use a difference within 0.01.
Expected result:
Use a larger difference.
Expected result:
Use a blank or non-numeric balance.
Expected result:
Once tests pass, you can safely activate the workflow.
This workflow is already useful as-is, but it can be adapted for different reconciliation processes.
Run Reconciliation on Schedule
You can change:
Useful if you want:
Match Accounts by Account ID
Currently matches on:
account_id
You can modify your data model and workflow if you want to include additional matching dimensions such as:
Only do this if your sheet structure supports it.
Calculate Balance Difference
Current tolerance:
const TOLERANCE = 0.01;
You can change this if your business allows different variance thresholds.
0 β exact reconciliation only0.01 β cent-level tolerance1 β whole-unit toleranceGenerate AI Mismatch Explanation
You can customize the prompt to include:
This is helpful if you want the AI output to be more operationally specific.
Log Matched RecordsAppend The Data In The SheetYou can extend the output to include additional columns such as:
Only add fields that exist in your upstream data or are intentionally created in the workflow.
Prepare Exception Record
You can enhance this node to add labels like:
This can help organize exception handling more efficiently.
This workflow can be extended with additional automation features depending on your operational needs.
Send a real-time alert whenever a mismatch is detected.
Useful for:
Send a daily or hourly summary of all mismatches to stakeholders.
Useful for:
Add logic to classify mismatches by size or business impact.
Useful for:
Automatically assign mismatch cases to specific team members based on:
Useful for structured exception management.
Push matched and mismatched records into a reporting dashboard.
Useful for:
Extend the workflow to support more entities, accounts or balance sources.
Useful for:
Below are some of the main ways this workflow can be used. There can absolutely be many more use cases depending on how your reconciliation process is structured.
Automatically compare daily internal records against custodian balances and flag any balance breaks for investigation.
Run the workflow at the end of each business day to ensure treasury balances match external sources before close.
Identify mismatched fund cash balances and create a structured exception sheet with AI-generated review notes.
Maintain a consistent log of matched and mismatched records for reporting, controls and audit readiness.
Use mismatches to spot operational problems such as missing values, incorrect balances or inconsistent source data.
Support teams that still work mainly in spreadsheets but want to reduce repetitive reconciliation effort using automation.
| Issue | Possible Cause | Solution |
|---|---|---|
| No records are being compared | One or both Google Sheets nodes are not returning data | Check that both source sheets contain rows and the correct sheet tabs are selected |
| Records are not matching correctly | account_id values differ between the two source sheets |
Make sure account_id values are identical and formatted consistently in both sheets |
| All rows are being flagged as mismatches | Balance fields contain text, blanks or invalid values | Ensure internal_balance and custodian_balance contain numeric values only |
| Small rounding differences are creating mismatches | Tolerance is too strict for your use case | Update the tolerance value in Calculate Balance Difference |
| Matched records are not being logged | Google Sheets append node is not configured correctly | Verify the target spreadsheet, sheet tab and credentials in Log Matched Records |
| Mismatch records are not being saved | Exception logging sheet is missing expected columns | Confirm the target sheet includes all mapped fields, including ai_explanation and recon_status |
| AI explanation is blank | OpenAI credentials or model configuration issue | Reconnect your OpenAI credentials and verify the model is available |
| Workflow fails after import | Credentials are not connected in your environment | Reassign all credential-dependent nodes after importing the workflow |
| Workflow does not run automatically | Schedule Trigger is not active or workflow is disabled | Activate the workflow and confirm the schedule settings |
| Numeric values look wrong in output | Source sheet values are stored with symbols or formatting | Remove currency symbols, commas or text formatting from balance columns |
If you want help setting up, customizing or extending this workflow, our n8n workflow automation team at WeblineIndia can help you move faster.
We can help you with: