{
  "nodes": [
    {
      "id": "b3a0fa7c-eb47-4f51-98d7-ac1a8de7b05d",
      "name": "On new or updated row",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        800,
        380
      ],
      "parameters": {
        "options": {
          "columnsToWatch": [
            "Security Code"
          ]
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "REPLACE_WITH_RESOURCE"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "REPLACE_WITH_RESOURCE"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "61b96d9b-801c-43e6-b89a-a55245386e4f",
      "name": "Send message",
      "type": "n8n-nodes-base.discord",
      "position": [
        1200,
        380
      ],
      "parameters": {
        "text": "=```\n{{ $json.ascii_table }}\n```",
        "options": {},
        "webhookUri": "https://example.invalid/REPLACE_WITH_WEBHOOK"
      },
      "typeVersion": 1
    },
    {
      "id": "2dc9ce88-2079-4419-9f48-2281ac25cb36",
      "name": "Convert to ASCII table",
      "type": "n8n-nodes-base.code",
      "position": [
        1000,
        380
      ],
      "parameters": {
        "jsCode": "/* configure columns to be displayed */\nconst columns_to_display = [\n  \"Security Code\",\n  \"Price\",\n  \"Quantity\",\n]\n\n/* End of configuration section (do not edit code below) */\nconst google_sheets_data = $('On new or updated row').all();\n\n/**\n * Takes a list of objects and returns an ascii table with\n * padding and headers.\n */\nfunction ascii_table(data, columns_to_display) {\n  let table = \"\"\n  \n  // Get the headers\n  let headers = []\n  for (let i = 0; i < columns_to_display.length; i++) {\n    headers.push(columns_to_display[i])\n  }\n\n  // Get the longest string in each column\n  let longest_strings = []\n  for (let i = 0; i < headers.length; i++) {\n    let longest_string = headers[i].length\n    for (let j = 0; j < data.length; j++) {\n      let string_length = data[j].json[headers[i]].length\n      if (string_length > longest_string) {\n        longest_string = string_length\n      }\n    }\n    longest_strings.push(longest_string)\n  }\n\n  // Add the headers to the table\n  for (let i = 0; i < headers.length; i++) {\n    table += headers[i].toString().padEnd(longest_strings[i] + 2, \" \")\n  }\n\n  // Add the data to the table\n  for (let i = 0; i < data.length; i++) {\n    table += \"\\n\"\n    for (let j = 0; j < headers.length; j++) {\n      table += data[i].json[headers[j]].toString().padEnd(longest_strings[j] + 2, \" \")\n    }\n  }\n\n  return table\n}\n\noutput = {\n  ascii_table: ascii_table(google_sheets_data, columns_to_display),\n}\n\nconsole.log(output.ascii_table)\n\nreturn output"
      },
      "typeVersion": 1
    },
    {
      "id": "2db7b37b-22f9-424d-a889-33f8a0db2b01",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        220
      ],
      "parameters": {
        "width": 402,
        "height": 433,
        "content": "## Send Google Sheets data as a message to a Discord channel\nThis workflow sends a message to a Discord channel when a new row is added or a row is updated in a Google Sheet. The message will send all data rows in the Google Sheet.\n\n### How it works\nUsing a code node, we can use the obtained Google Sheet data to create a custom message that will be sent to Discord. The message will be sent to the Discord channel specified in the Discord node.\n\n### Setup\nThis workflow requires that you set up a Discord webhook and have an existing Google Sheet with data. See how to set up a Discord webhook [here](https://docs.n8n.io/integrations/builtin/credentials/discord/#creating-a-webhook-in-discord).\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d3d72f6f-51b3-5752-a5ba-6095a20e3c1b",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        0
      ],
      "parameters": {
        "content": "# Send Google Sheets data as a message to a Discord channel\n\n## Purpose and structure\nThis folder contains the **Send Google Sheets data as a message to a Discord channel** workflow. Its executable nodes use `code`, `discord`, `googleSheetsTrigger`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nOn new or updated row\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nhttps://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Googlesheets/0314_GoogleSheets_Discord_Create_Triggered.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "connections": {
    "On new or updated row": {
      "main": [
        [
          {
            "node": "Convert to ASCII table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to ASCII table": {
      "main": [
        [
          {
            "node": "Send message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}
