{
  "nodes": [
    {
      "id": "da1b90d1-a828-484d-85f7-d67c9463d4de",
      "name": "Get many deals1",
      "type": "n8n-nodes-base.pipedrive",
      "position": [
        -528,
        7312
      ],
      "parameters": {
        "filters": {},
        "operation": "getAll",
        "returnAll": true
      },
      "typeVersion": 1
    },
    {
      "id": "e206c83f-d4e9-421e-b84c-7ef3200357ed",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -656,
        7312
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "845b7a0b-d4bc-4041-8c76-0c4d7dec578b",
      "name": "Categorize stages",
      "type": "n8n-nodes-base.code",
      "position": [
        -192,
        6912
      ],
      "parameters": {
        "jsCode": "const stageMap = {\n  1: \"Prospecting\",\n  2: \"Qualified\",\n  3: \"Proposal Sent\",\n  4: \"Negotiation\",\n  5: \"Closed Won\"\n};\nreturn items.map(item => {\n  const stageId = item.json.stage_id;\n  item.json.stage_name = stageMap[stageId] || `Unknown (${stageId})`;\n  return item;\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "a9191249-7b71-4218-ac59-4e6586f9c7f6",
      "name": "Today's Date",
      "type": "n8n-nodes-base.code",
      "position": [
        -144,
        7376
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      badges: {\n        today: new Date().toISOString().split('T')[0]  \n      }\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "c8317b16-77f2-4d03-b727-63d59ae6d0f1",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        64,
        7088
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3.2
    },
    {
      "id": "14a3cd0a-d1b1-4a57-82fa-4a2e05d7cd1a",
      "name": "Store in google",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        528,
        7072
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={ { $json.Date } }",
            "Deal": "={ { $json.Deal } }",
            "stage_name": "={ { $json.stage_name } }"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "stage_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "stage_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Deal",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Deal",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1u0i-sfPxmfmm5YMU3ekEdQgdOHA6OgnbI-VwuRMDq4Q"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "d7536de3-e3cc-41cf-a60d-2b295358cbde",
      "name": "Set Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        272,
        7088
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fc41847f-2c15-43ed-b627-970f270088ea",
              "name": "Date",
              "type": "string",
              "value": "={ { $json.badges.today } }"
            },
            {
              "id": "321b11b5-040f-4a34-b99b-55be66f97a39",
              "name": "stage_name",
              "type": "string",
              "value": "={ { $json.stage_name } }"
            },
            {
              "id": "cb9b3673-6826-400c-8d84-5cd29c095935",
              "name": "Deal",
              "type": "string",
              "value": "={ { $('Get many deals1').item.json.title } }"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Set Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Fields": {
      "main": [
        [
          {
            "node": "Store in google",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Today's Date": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get many deals1": {
      "main": [
        [
          {
            "node": "Categorize stages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Categorize stages": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get many deals1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}