AutomationFlowsData & Sheets › Agrosmart Weather Automation

Agrosmart Weather Automation

AgroSmart Weather Automation. Uses executeCommand, httpRequest, spreadsheetFile. Scheduled trigger; 6 nodes.

Cron / scheduled trigger★★★★☆ complexity6 nodesExecute CommandHTTP RequestSpreadsheet File
Data & Sheets Trigger: Cron / scheduled Nodes: 6 Complexity: ★★★★☆ Added:

This workflow follows the Executecommand → HTTP Request recipe pattern — see all workflows that pair these two integrations.

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 →

Download .json
{
  "name": "AgroSmart Weather Automation",
  "nodes": [
    {
      "parameters": {},
      "id": "trigger-schedule",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.1,
      "position": [
        250,
        300
      ],
      "credentials": {}
    },
    {
      "parameters": {
        "command": "cat ../data/vietnam_provinces_latlon.csv"
      },
      "id": "read-csv",
      "name": "Read Province CSV",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "credentials": {}
    },
    {
      "parameters": {
        "jsCode": "const lines = $input.all()[0].json.stdout.split('\\n');\nconst provinces = [];\n// Skip header\nfor (let i = 1; i < lines.length; i++) {\n  const line = lines[i].trim();\n  if (line) {\n    const parts = line.split(',');\n    provinces.push({\n      json: {\n        Province: parts[0],\n        Latitude: parts[1],\n        Longitude: parts[2]\n      }\n    });\n  }\n}\nreturn provinces;"
      },
      "id": "parse-csv",
      "name": "Parse CSV",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        650,
        300
      ],
      "credentials": {}
    },
    {
      "parameters": {
        "url": "https://power.larc.nasa.gov/api/temporal/daily/point",
        "authentication": "none",
        "sendQuery": true,
        "queryParameters": {
          "parameters": "T2M,PRECTOTCORR,RH2M",
          "community": "AG",
          "longitude": "={{$json.Longitude}}",
          "latitude": "={{$json.Latitude}}",
          "start": "20230101",
          "end": "20231231",
          "format": "JSON"
        },
        "options": {}
      },
      "id": "nasa-api",
      "name": "Fetch NASA Data",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        850,
        300
      ],
      "credentials": {}
    },
    {
      "parameters": {
        "jsCode": "const data = $input.all()[0].json;\nconst params = data.properties.parameter;\nconst province = $('Parse CSV').item.json.Province;\n\n// Calculate Annual Averages using strict JS\nlet t2m_sum = 0, count = 0, rain_sum = 0, rh_sum = 0;\n\n// Check if T2M exists\nif (params && params.T2M) {\n  for (const key in params.T2M) {\n    if (params.T2M[key] > -900) {\n      t2m_sum += params.T2M[key];\n      rain_sum += (params.PRECTOTCORR && params.PRECTOTCORR[key]) ? params.PRECTOTCORR[key] : 0;\n      rh_sum += (params.RH2M && params.RH2M[key]) ? params.RH2M[key] : 0;\n      count++;\n    }\n  }\n}\n\nreturn {\n  json: {\n    Province: province,\n    Year: 2023,\n    TempAvg: count ? (t2m_sum / count).toFixed(2) : 0,\n    RainfallAnnual: rain_sum.toFixed(2),\n    HumidityAvg: count ? (rh_sum / count).toFixed(2) : 0\n  }\n};"
      },
      "id": "calculate-avg",
      "name": "Calculate Annual Stats",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ],
      "credentials": {}
    },
    {
      "parameters": {
        "operation": "append",
        "fileName": "../data/n8n_weather_update.csv",
        "options": {
          "headerRow": true
        }
      },
      "id": "save-csv",
      "name": "Save to CSV",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ],
      "credentials": {}
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Read Province CSV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Province CSV": {
      "main": [
        [
          {
            "node": "Parse CSV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse CSV": {
      "main": [
        [
          {
            "node": "Fetch NASA Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch NASA Data": {
      "main": [
        [
          {
            "node": "Calculate Annual Stats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Annual Stats": {
      "main": [
        [
          {
            "node": "Save to CSV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

AgroSmart Weather Automation. Uses executeCommand, httpRequest, spreadsheetFile. Scheduled trigger; 6 nodes.

Source: https://github.com/thangtismo/HTKDTM/blob/b2d47f81d31d4596a67282a74315505cdb21a634/n8n/weather_automation.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

My workflow 6. Uses httpRequest, spreadsheetFile, emailSend, googleDrive. Scheduled trigger; 21 nodes.

HTTP Request, Spreadsheet File, Email Send +1
Data & Sheets

MyToys. Uses ftp, httpRequest, spreadsheetFile, executeCommand. Webhook trigger; 16 nodes.

Ftp, HTTP Request, Spreadsheet File +2
Data & Sheets

This workflow automates video distribution to 9 social platforms simultaneously using Blotato's API. It includes both a scheduled publisher (checks Google Sheets for videos marked "Ready") and a subwo

Google Sheets, HTTP Request, Form Trigger +2
Data & Sheets

YogiAI. Uses googleSheets, googleSheetsTool, httpRequest, stopAndError. Scheduled trigger; 61 nodes.

Google Sheets, Google Sheets Tool, HTTP Request +1
Data & Sheets

This workflow monitors Google Calendar for events indicating that a customer will visit the company today or the next day, retrieves the required details, and sends reminder notifications to the relev

Google Calendar, Google Sheets, HTTP Request +1