Skip to content

Unable to link results to sheets #3175

@sheyaln

Description

@sheyaln

Please use the 👍 reaction to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!

Describe the bug

"Create spreadsheet" from the Results page of a form always fails with "There was an error while linking the file" when Nextcloud uses S3 as primary storage. I am not a php developer, so take this analysis with a grain of salt:

The server log shows PhpOffice\PhpSpreadsheet\Reader\Exception: Unable to identify a reader for this file. The issue seems to be $node->newFile() on S3 objectstore creates a file containing a single space character (0x20) instead of a truly empty file. The Forms app then treats this as an existing spreadsheet and tries to load it with PhpSpreadsheet, which fails on the 1-byte content. Since the error fires before putContent() runs, the broken file persists and every retry hits the same failure.

The code I believe is relevant, found in SubmissionService::exportData():

if ($file && $file->getContent()) {
    // reached because " " (space) is truthy in PHP
    $existentFile = $this->tempManager->getTemporaryFile($fileFormat);
    file_put_contents($existentFile, $file->getContent());
    $spreadsheet = IOFactory::load($existentFile);  // fails — 1 byte is not valid XLSX/ODS/CSV
} else {
    $spreadsheet = new Spreadsheet();  // intended path for new files, never reached
}

To Reproduce

  1. Use Nextcloud with S3 as primary object storage
  2. Create a form and collect at least one submission
  3. Go to the form's Results tab
  4. Click the export menu → "Create spreadsheet"
  5. Select any directory in the file picker and click "Create XLSX" (or ODS/CSV)
  6. See error: "There was an error while linking the file"

Expected behavior

A new spreadsheet is created in the selected directory containing the form submissions, and the file is linked to the form for automatic sync.

Nextcloud (please complete the following information):

  • Nextcloud-Version: 32.0.6.1
  • Forms-Version: 5.2.4

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Firefox
  • Version: 147

Browser log

PATCH /ocs/v2.php/apps/forms/api/v3/forms/8 → 500

Server log

{
  "level": 3,
  "time": "2026-02-18T12:04:51+00:00",
  "app": "no app in context",
  "method": "PATCH",
  "url": "/ocs/v2.php/apps/forms/api/v3/forms/8",
  "message": "Unable to identify a reader for this file",
  "exception": {
    "Exception": "PhpOffice\\PhpSpreadsheet\\Reader\\Exception",
    "Message": "Unable to identify a reader for this file",
    "File": "/var/www/html/custom_apps/forms/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php",
    "Line": 205
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending approval or rejection. This issue is pending approval.bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions