The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "compare-csv-and-json-calendars",
"nodes": [
{
"parameters": {},
"id": "53ea3172-aee2-4ffc-8802-4b265742c66c",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
1000,
720
]
},
{
"parameters": {
"url": "http://xmlcalendar.ru/data/ru/2022/calendar.csv",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"id": "4db42691-eb5f-46ff-b665-d132f15fa4fa",
"name": "Get CSV File",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
1240,
580
]
},
{
"parameters": {
"url": "http://xmlcalendar.ru/data/ru/2022/calendar.json",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"id": "775e0224-02a4-403b-909d-3181e11a6861",
"name": "Get JSON File",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
1240,
880
]
},
{
"parameters": {
"fileFormat": "csv",
"options": {
"headerRow": true
}
},
"id": "7759d329-05dc-4936-8380-a95a6aa5d4dc",
"name": "Read CSV File",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 2,
"position": [
1480,
580
],
"alwaysOutputData": false
},
{
"parameters": {
"language": "python",
"pythonCode": "months = [\"\u042f\u043d\u0432\u0430\u0440\u044c\",\"\u0424\u0435\u0432\u0440\u0430\u043b\u044c\",\"\u041c\u0430\u0440\u0442\",\"\u0410\u043f\u0440\u0435\u043b\u044c\",\"\u041c\u0430\u0439\",\"\u0418\u044e\u043d\u044c\",\"\u0418\u044e\u043b\u044c\",\"\u0410\u0432\u0433\u0443\u0441\u0442\",\"\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c\",\"\u041e\u043a\u0442\u044f\u0431\u0440\u044c\",\"\u041d\u043e\u044f\u0431\u0440\u044c\",\"\u0414\u0435\u043a\u0430\u0431\u0440\u044c\"]\n\nstat_keys_mapping = {\n \"\u0412\u0441\u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0434\u043d\u0435\u0439\": \"workdays\",\n \"\u0412\u0441\u0435\u0433\u043e \u043f\u0440\u0430\u0437\u0434\u043d\u0438\u0447\u043d\u044b\u0445 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u043d\u0435\u0439\": \"holidays\",\n \"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0447\u0430\u0441\u043e\u0432 \u043f\u0440\u0438 40-\u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043d\u0435\u0434\u0435\u043b\u0435\": \"hours40\",\n \"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0447\u0430\u0441\u043e\u0432 \u043f\u0440\u0438 36-\u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043d\u0435\u0434\u0435\u043b\u0435\": \"hours36\",\n \"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0447\u0430\u0441\u043e\u0432 \u043f\u0440\u0438 24-\u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043d\u0435\u0434\u0435\u043b\u0435\": \"hours24\",\n}\n\nresult = []\n\nfor item in _input.all():\n row = item.json\n\n result_row = {}\n result_row[\"year\"] = int(row[\"\u0413\u043e\u0434/\u041c\u0435\u0441\u044f\u0446\"])\n result_row[\"months\"] = []\n result_row[\"statistic\"] = {}\n \n for i, month in enumerate(months):\n result_row[\"months\"].append({\n \"month\": i+1,\n \"days\": item.json[month]\n })\n\n for k, v in stat_keys_mapping.items():\n result_row[\"statistic\"][v] = float(row[k])\n\n result.append(result_row)\n\nreturn result"
},
"id": "6bbacabf-2c69-405e-a261-e10974b90f00",
"name": "Transform to JSON calendar schema",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1720,
580
]
},
{
"parameters": {
"mergeByFields": {
"values": [
{
"field1": "year",
"field2": "year"
},
{
"field1": "months",
"field2": "months"
},
{
"field1": "statistic",
"field2": "statistic"
}
]
},
"options": {}
},
"id": "e7a1d809-a10c-47aa-ac9c-c8a591de6ad3",
"name": "Compare Datasets",
"type": "n8n-nodes-base.compareDatasets",
"typeVersion": 2.3,
"position": [
1960,
720
]
},
{
"parameters": {
"options": {}
},
"id": "aec6760e-8be3-4c9e-a60e-3fe098681f3c",
"name": "Move Binary Data",
"type": "n8n-nodes-base.moveBinaryData",
"typeVersion": 1,
"position": [
1480,
880
]
},
{
"parameters": {
"language": "python",
"pythonCode": "result = _input.all()\nfor item in result:\n row = item.json\n if 'transitions' in row.keys():\n del row[\"transitions\"]\nreturn result"
},
"id": "1162b236-b1ac-425a-87d0-799d9105c558",
"name": "Remove transitions key",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1720,
880
]
}
],
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Get CSV File",
"type": "main",
"index": 0
},
{
"node": "Get JSON File",
"type": "main",
"index": 0
}
]
]
},
"Get CSV File": {
"main": [
[
{
"node": "Read CSV File",
"type": "main",
"index": 0
}
]
]
},
"Read CSV File": {
"main": [
[
{
"node": "Transform to JSON calendar schema",
"type": "main",
"index": 0
}
]
]
},
"Transform to JSON calendar schema": {
"main": [
[
{
"node": "Compare Datasets",
"type": "main",
"index": 0
}
]
]
},
"Get JSON File": {
"main": [
[
{
"node": "Move Binary Data",
"type": "main",
"index": 0
}
]
]
},
"Move Binary Data": {
"main": [
[
{
"node": "Remove transitions key",
"type": "main",
"index": 0
}
]
]
},
"Remove transitions key": {
"main": [
[
{
"node": "Compare Datasets",
"type": "main",
"index": 1
}
]
]
},
"Compare Datasets": {
"main": [
[],
[],
[],
[]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "870140aa-9cc7-4265-bbff-3c2dd0195f05",
"id": "YYXCyB8eL1IEJ1Bn",
"tags": []
}
About this workflow
compare-csv-and-json-calendars. Uses manualTrigger, httpRequest, spreadsheetFile, compareDatasets. Event-driven trigger; 8 nodes.
Source: https://gitlab.com/sablev/n8n-files-compare-workflow/-/blob/main/n8n-files-compare-workflow.json — original creator credit. Request a take-down →