Merge pull request #11 from thomasleveil/awesome-n8n-workflows

📚 add an awesome collection of n8n workflows
This commit is contained in:
Jan 2019-08-22 07:11:34 +02:00 committed by GitHub
commit 376270c94c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 376 additions and 1 deletions

View file

@ -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).

68
docs/workflows/README.md Normal file
View file

@ -0,0 +1,68 @@
<div align="center">
<img width="464" height="106" src="../images/n8n-logo.png" alt="n8n">
<br>
<br>
<br>
</div>
<br>
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)

View file

@ -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
}
]
]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -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
}
]
]
}
}
}

BIN
docs/workflows/for-loop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -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
}
]
]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -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
}
]
]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB