{ "name": "Bullion API gold price to Google Sheets", "nodes": [ { "parameters": { "rule": { "interval": [ { "field": "cronExpression", "expression": "15 * * * 1-5" } ] } }, "id": "3d6b1f0e-1a2b-4c3d-8e9f-0a1b2c3d4e01", "name": "Schedule Trigger", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [0, 0] }, { "parameters": { "method": "GET", "url": "https://api.bullionapi.dev/v1/gold/price?currency=USD&unit=troy_oz", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "options": {} }, "id": "3d6b1f0e-1a2b-4c3d-8e9f-0a1b2c3d4e02", "name": "Bullion API price", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.5, "position": [220, 0], "credentials": { "httpHeaderAuth": { "id": "REPLACE_WITH_HEADER_AUTH_CREDENTIAL_ID", "name": "Bullion API key (X-API-Key)" } } }, { "parameters": { "jsCode": "const observation = $input.first().json.series[0].observations[0];\nreturn [\n {\n json: {\n metal: 'gold',\n currency: 'USD',\n unit: 'troy_oz',\n price: observation.value,\n observed_at: observation.date,\n },\n },\n];" }, "id": "3d6b1f0e-1a2b-4c3d-8e9f-0a1b2c3d4e03", "name": "Shape row", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [440, 0] }, { "parameters": { "operation": "append", "documentId": { "__rl": true, "mode": "id", "value": "REPLACE_WITH_SPREADSHEET_ID" }, "sheetName": { "__rl": true, "mode": "name", "value": "Prices" }, "columns": { "mappingMode": "defineBelow", "value": { "metal": "={{ $json.metal }}", "currency": "={{ $json.currency }}", "unit": "={{ $json.unit }}", "price": "={{ $json.price }}", "observed_at": "={{ $json.observed_at }}" }, "matchingColumns": [], "schema": [ { "id": "metal", "displayName": "metal", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false }, { "id": "currency", "displayName": "currency", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false }, { "id": "unit", "displayName": "unit", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false }, { "id": "price", "displayName": "price", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false }, { "id": "observed_at", "displayName": "observed_at", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true, "removed": false } ], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {} }, "id": "3d6b1f0e-1a2b-4c3d-8e9f-0a1b2c3d4e04", "name": "Append to Google Sheets", "type": "n8n-nodes-base.googleSheets", "typeVersion": 4.7, "position": [660, 0], "credentials": { "googleSheetsOAuth2Api": { "id": "REPLACE_WITH_GOOGLE_SHEETS_CREDENTIAL_ID", "name": "Google Sheets account" } } } ], "connections": { "Schedule Trigger": { "main": [ [ { "node": "Bullion API price", "type": "main", "index": 0 } ] ] }, "Bullion API price": { "main": [ [ { "node": "Shape row", "type": "main", "index": 0 } ] ] }, "Shape row": { "main": [ [ { "node": "Append to Google Sheets", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1", "timezone": "UTC" }, "tags": [] }