justkawal / excel

Excel Library for Flutter and Dart - https://pub.dev/packages/excel
MIT License
429 stars 240 forks source link

Error decodeBytes Excel xlsx #325

Open RacinesAndres opened 9 months ago

RacinesAndres commented 9 months ago
  1. How to produce the error

I use the _"filepicker 6.1.1" package to select the xlsx.

final result = await FilePicker.platform.pickFiles();

File file = File(result!.files.single.path!);
var bytes = File(file.path).readAsBytesSync();
var excel = Excel.decodeBytes(bytes);
  1. Error

When it passes through the decoder the following error occurs: Unhandled Exception: Exception: custom numFmtId starts at 164 but found a value of 43

error

  1. Version of the error excel: ^4.0.2

  2. Functional version (without error) Excel ^3.0.0

  3. Flutter doctor: [√] Flutter (Channel stable, 3.16.8, on Microsoft Windows [Versi¢n 10.0.19045.4046], locale es-CO) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3) [√] Android Studio (version 2022.3) [√] VS Code (version 1.86.2) [√] Connected device (4 available) [√] Network resources

michelemazzei commented 9 months ago

Hi, I have the same problem. I think is a problem related of the dates format. I confirm that using the 3.0.0 it works

ajaykumar666 commented 6 months ago

facing the same error when running on the Windows app. any solution? I have checked different version of excel package, nothing works

eldarkk commented 5 months ago

same issue

hutomosaktikartiko commented 5 months ago

I got same issue

ChreSyr commented 4 months ago

same here

FedeRotoli commented 3 months ago

Same here

ajaykumar666 commented 3 months ago

In my case the file picker was working fine, but the Excel package was throwing an error. got it resolved by using excel: ^2.0.0-null-safety-3

mellowcello77 commented 2 months ago

Any one know how to fix this, happy to use a custom git url fix from someone, not sure where to make the change myself.

eldarkk commented 2 months ago

Any way to fix guys ?

nfrawley93 commented 1 month ago

Here is a solution. It likely isn't what you want but this is the fix. Likely the excel file you are using is "wrongly formatted" it could have been previously made by another program that didn't completely conform to excel standards, or it might just be a csv. Sometimes I had this happen if something was saved as an excel from google docs/libre office/numbers. You can test this by creating a new excel sheet In Microsoft Excel and copy everything over. It will no longer have the issue. For one off files the fix is simply this, or to open the file in excel and "Save As" a new file and it will correct it.

legrandced commented 2 days ago

Here is a solution. It likely isn't what you want but this is the fix. Likely the excel file you are using is "wrongly formatted" it could have been previously made by another program that didn't completely conform to excel standards, or it might just be a csv. Sometimes I had this happen if something was saved as an excel from google docs/libre office/numbers. You can test this by creating a new excel sheet In Microsoft Excel and copy everything over. It will no longer have the issue. For one off files the fix is simply this, or to open the file in excel and "Save As" a new file and it will correct it.

That worked for me.