Unable to read/write/merge into nextcloud spreadsheet

Inspired by Typeform to Spreadsheet on NextCloud I would like, ultimately merge my HTTP request with a spreadsheet hosted in a Nextcloud instance.

Sadly it seems to hang at the merge and when I bypass the merge, with or without a spreadsheet node, the file is successfully created on the Nextcloud side, but it is empty.

On the Download side

it always say: Entries exist but they do not contain any JSON data.
even if tried the File Path with and without the slash (/) in front of file name and if I specify the sheet

On the Upload side, I tried:

  • with the file already created and without
  • with the column header (title and url) already defined and without
  • as xls and xlsx (which I would prefer since I would be able to read it with ONLYOffice)

my json in case

{
  "name": "Entreprises par secteur",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        -100,
        220
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"url\"]}}",
              "operation": "contains",
              "value2": "liste-"
            }
          ]
        }
      },
      "name": "url=liste-*",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        680,
        300
      ],
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "sourceData": "=json",
        "dataPropertyName": "key",
        "extractionValues": {
          "values": [
            {
              "key": "title",
              "cssSelector": "a"
            },
            {
              "key": "url",
              "cssSelector": "a",
              "returnValue": "attribute",
              "attribute": "href"
            }
          ]
        },
        "options": {}
      },
      "name": "title+url",
      "type": "n8n-nodes-base.htmlExtract",
      "typeVersion": 1,
      "position": [
        540,
        300
      ]
    },
    {
      "parameters": {
        "extractionValues": {
          "values": [
            {
              "key": "key",
              "cssSelector": "=p",
              "returnValue": "html",
              "returnArray": true
            }
          ]
        },
        "options": {}
      },
      "name": "paragraph",
      "type": "n8n-nodes-base.htmlExtract",
      "typeVersion": 1,
      "position": [
        400,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://www.societe.com/liste-69.html",
        "responseFormat": "file",
        "options": {}
      },
      "name": "Rhone69",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        120,
        300
      ]
    },
    {
      "parameters": {},
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        -100,
        360
      ],
      "disabled": true
    },
    {
      "parameters": {
        "setAllData": false,
        "options": {
          "encoding": "iso88591"
        }
      },
      "name": "iso88591",
      "type": "n8n-nodes-base.moveBinaryData",
      "typeVersion": 1,
      "position": [
        260,
        300
      ]
    },
    {
      "parameters": {
        "operation": "download",
        "path": "/n8n_rhone69.xlsx"
      },
      "name": "download",
      "type": "n8n-nodes-base.nextCloud",
      "typeVersion": 1,
      "position": [
        460,
        100
      ],
      "credentials": {
        "nextCloudApi": {
          "id": "3",
          "name": "ecloud.global"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "name": "read",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        680,
        100
      ]
    },
    {
      "parameters": {},
      "name": "merge",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        920,
        220
      ]
    },
    {
      "parameters": {
        "operation": "toFile",
        "fileFormat": "xlsx",
        "options": {}
      },
      "name": "write",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        1100,
        220
      ]
    },
    {
      "parameters": {
        "path": "n8n_rhone69.xlsx"
      },
      "name": "upload",
      "type": "n8n-nodes-base.nextCloud",
      "typeVersion": 1,
      "position": [
        1280,
        220
      ],
      "credentials": {
        "nextCloudApi": {
          "id": "3",
          "name": "ecloud.global"
        }
      }
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Rhone69",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "title+url": {
      "main": [
        [
          {
            "node": "url=liste-*",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "paragraph": {
      "main": [
        [
          {
            "node": "title+url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rhone69": {
      "main": [
        [
          {
            "node": "iso88591",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cron": {
      "main": [
        [
          {
            "node": "Rhone69",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "url=liste-*": {
      "main": [
        [
          {
            "node": "merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "iso88591": {
      "main": [
        [
          {
            "node": "paragraph",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "download": {
      "main": [
        [
          {
            "node": "read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "read": {
      "main": [
        [
          {
            "node": "merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "merge": {
      "main": [
        [
          {
            "node": "write",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "write": {
      "main": [
        [
          {
            "node": "upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": 7
}

Hi @JOduMonT, the downloaded file should be visible under the “Binary” tab of your Nextcloud node:

This binary file would be what your spreadsheet node can read:

The upload should then work fine with the Binary Data option enabled:

When checking my Nextcloud instance, the file is available and contains the merged data:


image

Seeing you are saying the workflow is hanging, is there a chance your existing file does not contain any data yet? If a node outputs 0 items, execution would stop.

Yes I have like you but when I click on Show Binary Data it say This plugin is not supported;

but when I add Read As String like you it say my xlsx is a Corrupted zip file :stuck_out_tongue:

ERROR: End of data reached (data length = 12298, asked index = 470745088). Corrupted zip ?
 Details
Stack
Error: End of data reached (data length = 12298, asked index = 470745088). Corrupted zip ?
    at Uint8ArrayReader.checkIndex (/app/code/node_modules/xlsx/jszip.js:272:19)
    at Uint8ArrayReader.setIndex (/app/code/node_modules/xlsx/jszip.js:281:14)
    at ZipEntries.readCentralDir (/app/code/node_modules/xlsx/jszip.js:2267:21)
    at ZipEntries.load (/app/code/node_modules/xlsx/jszip.js:2345:14)
    at new ZipEntries (/app/code/node_modules/xlsx/jszip.js:2168:14)
    at JSZipSync.module.exports [as load] (/app/code/node_modules/xlsx/jszip.js:581:18)
    at new JSZipSync (/app/code/node_modules/xlsx/jszip.js:528:14)
    at zip_read (/app/code/node_modules/xlsx/xlsx.js:2974:38)
    at read_zip (/app/code/node_modules/xlsx/xlsx.js:21824:8)
    at Object.readSync [as read] (/app/code/node_modules/xlsx/xlsx.js:21894:69)

Awesome if I do abstraction of the import part yes this workflow work ;), thanks again!


So with your help, I could continue my project, but when it will be time to update the file via the cronjob it will not work

but when I add Read As String like you it say my xlsx is a Corrupted zip file :stuck_out_tongue:

Oh, I was using a CSV file in my example, sorry for the confusion. Reading an XLSX file also works fine for me though with a workflow like this:

{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "operation": "download",
        "path": "/Issues/Community 9895/test.xlsx"
      },
      "name": "Nextcloud",
      "type": "n8n-nodes-base.nextCloud",
      "typeVersion": 1,
      "position": [
        460,
        300
      ],
      "credentials": {
        "nextCloudApi": {
          "id": "34",
          "name": "NextCloud account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "operation": "download",
        "path": "/Issues/Community 9895/test.xlsx"
      },
      "name": "Nextcloud",
      "type": "n8n-nodes-base.nextCloud",
      "typeVersion": 1,
      "position": [
        460,
        300
      ],
      "credentials": {
        "nextCloudApi": {
          "id": "34",
          "name": "NextCloud account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Nextcloud",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nextcloud": {
      "main": [
        [
          {
            "node": "Spreadsheet File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
1 Like

Actually it work perfectly now, and you make my day by helping me make my first workflow with n8n.
I was even being able to find the solution for my merge node :slight_smile:

I just wish discourse had a tipping system