GGSheet Read

Hy, i have a problema, my google sheet node, in mode read,
is skipping 2 lines in reading

Hey @salvioni13,

Welcome to the community :sparkling_heart:

Can share more information? If you can share your workflow or even the screenshot of the node, it will help us understand better.

2 Likes
{
  "nodes": [
    {
      "parameters": {
        "url": "=https://fretefacil.tray.com.br/tracking/{{$json[\"codigo_rastreio\"]}}",
        "responseFormat": "string",
        "options": {}
      },
      "name": "CollectDataTrack",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        880,
        460
      ]
    },
    {
      "parameters": {
        "extractionValues": {
          "values": [
            {
              "key": "item",
              "cssSelector": "tr",
              "returnValue": "html",
              "returnArray": true
            },
            {
              "key": "codigo_true",
              "cssSelector": "h5"
            },
            {
              "key": "codigo_false",
              "cssSelector": "h4"
            }
          ]
        },
        "options": {}
      },
      "name": "ExtractHTML",
      "type": "n8n-nodes-base.htmlExtract",
      "position": [
        1330,
        460
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "functionCode": "// Code here will run only once, no matter how many input items there are.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function\n\n// Loop over inputs and add a new field called 'myNewField' to the JSON of each one\nfor (item of items) {\nlet x = item.json.codigo_rastreio + \"\";\n\n  if(x.length < 14){\n    item.json.codigo_rastreio = \"0\"+item.json.codigo_rastreio;\n  }else{\n  }\n\n  \n}\n\n// You can write logs to the browser console\nconsole.log('Done!');\n\nreturn items;"
      },
      "name": "CorrectStringTrack1",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        660,
        460
      ]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "name": "SplitInBatches2",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        1090,
        460
      ]
    },
    {
      "parameters": {
        "functionCode": "let string = \"\";\nlet date = \"\";\nlet locale = \"\";\nlet situation = \"\";\nlet codigo_rastreio = \"\";\nlet x = \"\";\nlet track = {};\n\n\nfor (item of items){\n    x = item.json.codigo_true;\n    codigo_rastreio = x.substring(x.indexOf(\":\")+2, x.indexOf(\":\")+16);\n    \n    string = item.json.item[1];\n    string = string.replace(/ /g,'');  \n    string = string.replace(/(\\r\\n|\\n|\\r)/gm, \"\");\n  \n    situation = string.substring(string.indexOf(\"<p>\")+3, string.indexOf(\"</p>\"));\n    date = string.substring(string.indexOf(\"<h6>\")+4, string.indexOf(\"</h6>\"));\n    locale = string.substring(string.indexOf(\"</h6></th><th>\")+14, string.indexOf(\"</th><th><p>\"));  \n    \n    track.status = situation;\n    track.ultima_atualizacao = date;\n    track.ultimo_local = locale;\n    track.codigo_rastreio = parseInt(codigo_rastreio);\n\n    items[0].json = track;\n\n}\n\nreturn items;"
      },
      "name": "ExtractDataTrack",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1520,
        460
      ]
    },
    {
      "parameters": {
        "webhookUri": "https://discord.com/api/webhooks/889833460611579905/MprlMZbuf4GHiCHhLLDkkSidCnWV9pkzrwyDrLdnxNYGTiK6DztsqbKqUvWNqH1HgLMR",
        "text": "={{$node[\"SplitInBatches2\"].json[\"ultima_atualizacao\"]}}{{$node[\"SplitInBatches2\"].json[\"ultimo_local\"]}}{{$node[\"SplitInBatches2\"].json[\"status\"]}}\n\nATUALIZAÇÂO PARA:\n\n{{$node[\"ExtractDataTrack\"].json[\"ultima_atualizacao\"]}} {{$node[\"ExtractDataTrack\"].json[\"ultimo_local\"]}} {{$node[\"ExtractDataTrack\"].json[\"status\"]}}"
      },
      "name": "Discord",
      "type": "n8n-nodes-base.discord",
      "typeVersion": 1,
      "position": [
        1910,
        460
      ]
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "sheetId": "={{$json[\"query\"][\"sheet\"]}}",
        "range": "A:I",
        "options": {}
      },
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        490,
        460
      ],
      "credentials": {
        "googleSheetsOAuth2Api": "Salvioni"
      }
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "operation": "update",
        "sheetId": "={{$node[\"Webhook\"].json[\"query\"][\"sheet\"]}}",
        "range": "A:I",
        "dataStartRow": 2,
        "key": "codigo_rastreio",
        "options": {}
      },
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1730,
        460
      ],
      "credentials": {
        "googleSheetsOAuth2Api": "Salvioni"
      }
    }
  ],
  "connections": {
    "CollectDataTrack": {
      "main": [
        [
          {
            "node": "SplitInBatches2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ExtractHTML": {
      "main": [
        [
          {
            "node": "ExtractDataTrack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CorrectStringTrack1": {
      "main": [
        [
          {
            "node": "CollectDataTrack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches2": {
      "main": [
        [
          {
            "node": "SplitInBatches2",
            "type": "main",
            "index": 0
          },
          {
            "node": "ExtractHTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ExtractDataTrack": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "CorrectStringTrack1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets1": {
      "main": [
        [
          {
            "node": "Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Hey @salvioni13,

Thanks for sharing your workflow. I tried replicating the issue, but I couldn’t. The Google Sheets node returns all the items for my sheet.

Hey @salvioni13,

Did you fix it? Let me know if you are still facing the same issue.

As mentioned, I was not able to replicate the issue. If you could share your Sheet it might help :slight_smile: