diff --git a/docs/README.md b/docs/README.md index c1bb85aed..dbb1582ae 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,4 +2,4 @@ ![n8n.io - Workflow Automation](https://raw.githubusercontent.com/n8n-io/n8n/master/docs/images/n8n-logo.png) -Documentation coming soon... +Documentation coming soon... in the meantime, you can browse the [awesome collection of n8n workflows](workflows/README.md). \ No newline at end of file diff --git a/docs/workflows/README.md b/docs/workflows/README.md new file mode 100644 index 000000000..5c288b87c --- /dev/null +++ b/docs/workflows/README.md @@ -0,0 +1,68 @@ +
+ n8n +
+
+
+
+ +
+ + +Awesome n8n workflows collection +================================ + + +You will find here a collection of n8n worflow examples that can be easily imported in n8n. + + +## Contents + +- [For loop](#for-loop) - how to iterate over an JSON array +- [Excel to Postgres](#excel-to-postgres) - how to migrate data from Excel to PostgreSQL +- [Postgres to Excel](#postgres-to-excel) - how to migrate data from Postgres to Excel +- [Update Postgres rows](#update-postgres-rows) - how to update PostreSQL rows + + + +## For loop + +![](for-loop.png) + +1. Make an HTTP request that responds with a JSON array +1. For each item in the response array, make an HTTP request + +[Download workflow](for-loop.json) + + + +## Excel to Postgres + +![](excel-to-postgres.png) + +1. Read XLS from file +1. convert it to JSON +1. insert it in Postgres + +[Download workflow](excel-to-postgres.json) + + + +## Postgres to Excel + +![](postgres-to-excel.png) + +1. Read data from Postgres +1. Converting it to XLS +1. save it to disk + +[Download workflow](postgres-to-excel.json) + + + +## Update Postgres rows + +![](update-postgres-rows.png) + +- Simple update of data + +[Download workflow](update-postgres-rows.json) diff --git a/docs/workflows/excel-to-postgres.json b/docs/workflows/excel-to-postgres.json new file mode 100644 index 000000000..f1cb291c9 --- /dev/null +++ b/docs/workflows/excel-to-postgres.json @@ -0,0 +1,76 @@ +{ + "nodes": [ + { + "parameters": {}, + "name": "Start", + "type": "n8n-nodes-base.start", + "typeVersion": 1, + "position": [ + 250, + 300 + ] + }, + { + "parameters": { + "filePath": "spreadsheet.xls" + }, + "name": "Read Binary File", + "type": "n8n-nodes-base.readBinaryFile", + "typeVersion": 1, + "position": [ + 450, + 650 + ] + }, + { + "parameters": {}, + "name": "Spreadsheet File1", + "type": "n8n-nodes-base.spreadsheetFile", + "typeVersion": 1, + "position": [ + 600, + 650 + ] + }, + { + "parameters": { + "table": "product", + "columns": "name,ean" + }, + "name": "Insert Rows1", + "type": "n8n-nodes-base.postgres", + "typeVersion": 1, + "position": [ + 750, + 650 + ], + "credentials": { + "postgres": "postgres" + } + } + ], + "connections": { + "Read Binary File": { + "main": [ + [ + { + "node": "Spreadsheet File1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Spreadsheet File1": { + "main": [ + [ + { + "node": "Insert Rows1", + "type": "main", + "index": 0 + } + ] + ] + } + } +} \ No newline at end of file diff --git a/docs/workflows/excel-to-postgres.png b/docs/workflows/excel-to-postgres.png new file mode 100644 index 000000000..524799964 Binary files /dev/null and b/docs/workflows/excel-to-postgres.png differ diff --git a/docs/workflows/for-loop.json b/docs/workflows/for-loop.json new file mode 100644 index 000000000..abaa8c62d --- /dev/null +++ b/docs/workflows/for-loop.json @@ -0,0 +1,97 @@ +{ + "nodes": [ + { + "parameters": {}, + "name": "Start", + "type": "n8n-nodes-base.start", + "typeVersion": 1, + "position": [ + 250, + 300 + ] + }, + { + "parameters": { + "url": "https://jsonplaceholder.typicode.com/posts?userId=1", + "headerParametersUi": { + "parameter": [] + } + }, + "name": "Http Request", + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 1, + "position": [ + 400, + 300 + ] + }, + { + "parameters": { + "functionCode": "const newItems = [];\nfor (const item of items[0].json) {\n newItems.push({json: item});\n}\nreturn newItems;" + }, + "name": "Function", + "type": "n8n-nodes-base.function", + "typeVersion": 1, + "position": [ + 550, + 300 + ] + }, + { + "parameters": { + "url": "https://postman-echo.com/get", + "responseFormat": "string", + "queryParametersUi": { + "parameter": [ + { + "name": "title", + "value": "={{$node[\"Function\"].data[\"title\"]}}" + } + ] + } + }, + "name": "Http Request1", + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 1, + "position": [ + 700, + 300 + ] + } + ], + "connections": { + "Start": { + "main": [ + [ + { + "node": "Http Request", + "type": "main", + "index": 0 + } + ] + ] + }, + "Http Request": { + "main": [ + [ + { + "node": "Function", + "type": "main", + "index": 0 + } + ] + ] + }, + "Function": { + "main": [ + [ + { + "node": "Http Request1", + "type": "main", + "index": 0 + } + ] + ] + } + } + } \ No newline at end of file diff --git a/docs/workflows/for-loop.png b/docs/workflows/for-loop.png new file mode 100644 index 000000000..e8d5233f7 Binary files /dev/null and b/docs/workflows/for-loop.png differ diff --git a/docs/workflows/postgres-to-excel.json b/docs/workflows/postgres-to-excel.json new file mode 100644 index 000000000..f1e444e37 --- /dev/null +++ b/docs/workflows/postgres-to-excel.json @@ -0,0 +1,78 @@ +{ + "nodes": [ + { + "parameters": {}, + "name": "Start", + "type": "n8n-nodes-base.start", + "typeVersion": 1, + "position": [ + 250, + 300 + ] + }, + { + "parameters": { + "operation": "executeQuery", + "query": "SELECT name, ean FROM product" + }, + "name": "Run Query", + "type": "n8n-nodes-base.postgres", + "typeVersion": 1, + "position": [ + 450, + 450 + ], + "credentials": { + "postgres": "postgres" + } + }, + { + "parameters": { + "operation": "toFile" + }, + "name": "Spreadsheet File", + "type": "n8n-nodes-base.spreadsheetFile", + "typeVersion": 1, + "position": [ + 600, + 450 + ] + }, + { + "parameters": { + "fileName": "spreadsheet.xls" + }, + "name": "Write Binary File", + "type": "n8n-nodes-base.writeBinaryFile", + "typeVersion": 1, + "position": [ + 750, + 450 + ] + } + ], + "connections": { + "Run Query": { + "main": [ + [ + { + "node": "Spreadsheet File", + "type": "main", + "index": 0 + } + ] + ] + }, + "Spreadsheet File": { + "main": [ + [ + { + "node": "Write Binary File", + "type": "main", + "index": 0 + } + ] + ] + } + } +} \ No newline at end of file diff --git a/docs/workflows/postgres-to-excel.png b/docs/workflows/postgres-to-excel.png new file mode 100644 index 000000000..505a51052 Binary files /dev/null and b/docs/workflows/postgres-to-excel.png differ diff --git a/docs/workflows/update-postgres-rows.json b/docs/workflows/update-postgres-rows.json new file mode 100644 index 000000000..e37a8ab8c --- /dev/null +++ b/docs/workflows/update-postgres-rows.json @@ -0,0 +1,56 @@ +{ + "nodes": [ + { + "parameters": {}, + "name": "Start", + "type": "n8n-nodes-base.start", + "typeVersion": 1, + "position": [ + 250, + 300 + ] + }, + { + "parameters": { + "functionCode": "const newItems = [];\nfor (let i=1;i < 6; i++) {\n newItems.push({\n json: {\n id: i,\n name: `New name ${i}`,\n ean: `New EAN ${i}`,\n }\n });\n}\nreturn newItems;" + }, + "name": "Function1", + "type": "n8n-nodes-base.function", + "typeVersion": 1, + "position": [ + 460, + 300 + ] + }, + { + "parameters": { + "operation": "update", + "table": "product", + "columns": "name,ean" + }, + "name": "Update Rows", + "type": "n8n-nodes-base.postgres", + "typeVersion": 1, + "position": [ + 610, + 300 + ], + "credentials": { + "postgres": "postgres" + } + } + ], + "connections": { + "Function1": { + "main": [ + [ + { + "node": "Update Rows", + "type": "main", + "index": 0 + } + ] + ] + } + } +} \ No newline at end of file diff --git a/docs/workflows/update-postgres-rows.png b/docs/workflows/update-postgres-rows.png new file mode 100644 index 000000000..32293f7fc Binary files /dev/null and b/docs/workflows/update-postgres-rows.png differ