Skip to content

Excel File Generated in Flutter Web Cannot Be Opened in Microsoft Excel #4

Closed

Description

@ParthBaraiya

What happened

Issue: Excel File Generated in Flutter Web Cannot Be Opened in Microsoft Excel

I am generating an Excel (.xlsx) file in my Flutter application using the excel_plus package.

The file is generated and downloaded successfully on the web platform. However, Microsoft Excel reports an error when I try to open it.

Interestingly, the same Excel generation logic works correctly in the mobile application. Files generated on mobile open without any issues.

Expected behavior: Excel files generated by the Flutter web application should open successfully in Microsoft Excel, just like files generated by the mobile application.

Actual behavior: Files generated on Flutter Web are downloaded successfully but cannot be opened in Microsoft Excel.

Environment:

  • Framework: Flutter
  • Platform: Flutter Web
  • Excel package: excel_plus 2.27.1
  • File download package: file_saver
  • File format: .xlsx

I am attaching 2 excels one generated from web and another from mobile.

test-web.xlsx - Generated from web -> Not working
test-mobile.xlsx - Generated from mobile -> Working fine

What were you doing

Creating a file from scratch

Where did the file come from

Not applicable

excel_plus version

2.27.1

Dart or Flutter version

Flutter: 3.47.4

Where it runs

Web (dart2js)

Code that reproduces it

import 'dart:typed_data';
import 'package:excel_plus/excel_plus.dart';

Future<Uint8List> generateTestXlsx() async {
  final excel = Excel.createExcel();
  final sheet = excel['Sheet1'];

  sheet.updateCell(
    CellIndex.indexByString('A1'),
    TextCellValue('Hello Excel'),
  );

  final bytes = excel.encode();

  if (bytes == null) {
    throw StateError('XLSX encoding failed.');
  }

  return Uint8List.fromList(bytes);
}

// Generates excel bytes
final bytes = generateTestXlsx();

// Save file
await FileSaver.instance.saveFile(
  name: 'test',
  bytes: bytes,
  fileExtension: 'xlsx',
  mimeType: MimeType.microsoftExcel,
);

Error and stack trace

The file, if you can share it

No response

Before submitting

  • I reproduced this on the latest published version.
  • The file opens correctly in the application that wrote it.

Activity

  1. added
    bug
    on Oct 10, 2026
  2. ParthBaraiya commented on Oct 11, 2026

    @ParthBaraiya
    Author

    Update:

    The issue has been identified in the archive package. I've submitted a fix in [PR #420](brendan-duncan/archive#420).

    Once the PR is merged and a new package version is released, updating the archive dependency version in pubspec.yaml should resolve this issue.

  3. ParthBaraiya commented on Oct 11, 2026

    @ParthBaraiya
    Author

    New version of archive package is released with the fix. So, running dart pub upgrade should fix the issue.

    I've raised the #5 to update the min version of archive package to avoid any unexpected failures.

  4. almasumdev commented on Oct 16, 2026

    @almasumdev
    Owner

    Thanks @ParthBaraiya, and not just for the report. You traced this past excel_plus into archive, worked out that it was corrupting entries on web, and then went and fixed it upstream rather than asking us to work around it. That is a lot more work than filing a bug, and it fixed the problem for everyone using archive, not only for us here.

    Your PR #5 is merged and shipped in 2.27.2, so the minimum is now ^4.5.1 and a resolve can no longer land on a version with the bug. You are on the contributor list for the repo too.

    If excel_plus is useful to you, a star would be genuinely appreciated. It is the main way the package gets found by people with the same problem you had.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions