Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse through some excel files #24

Closed
sanilch99 opened this issue May 27, 2020 · 3 comments
Closed

Unable to parse through some excel files #24

sanilch99 opened this issue May 27, 2020 · 3 comments
Assignees

Comments

@sanilch99
Copy link

I was trying to parse through the an xls file which gave me the given error, this error has occurred for some xlsx files as well

E/flutter (21854): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: FormatException: Could not find End of Central Directory Record
E/flutter (21854): #0 ZipDirectory._findSignature (package:archive/src/zip/zip_directory.dart:149:5)
E/flutter (21854): #1 new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:28:20)
E/flutter (21854): #2 ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:21:30)
E/flutter (21854): #3 ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:15:12)
E/flutter (21854): #4 new Excel.decodeBytes (package:excel/src/excel.dart:122:32)
E/flutter (21854): #5 Excelifiers.excelToSql (package:excelify/Excelifiers.dart:57:23)
E/flutter (21854):
E/flutter (21854): #6 _HomeState.build. (package:excelify/home.dart:45:35)
E/flutter (21854): #7 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
E/flutter (21854): #8 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:789:36)
E/flutter (21854): #9 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (21854): #10 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
E/flutter (21854): #11 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
E/flutter (21854): #12 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:199:7)
E/flutter (21854): #13 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:467:9)
E/flutter (21854): #14 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76:12)
E/flutter (21854): #15 PointerRouter._dispatchEventToRoutes. (package:flutter/src/gestures/pointer_router.dart:117:9)
E/flutter (21854): #16 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
E/flutter (21854): #17 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:115:18)
E/flutter (21854): #18 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:7)
E/flutter (21854): #19 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
E/flutter (21854): #20 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (21854): #21 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (21854): #22 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (21854): #23 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (21854): #24 _rootRunUnary (dart:async/zone.dart:1138:13)
E/flutter (21854): #25 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (21854): #26 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7)
E/flutter (21854): #27 _invoke1 (dart:ui/hooks.dart:273:10)
E/flutter (21854): #28 _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)

@justkawal
Copy link
Owner

This library does not support xls files for now.

But if you face any issue in reading xlsx file then I would be happy to find out the issue, but for that : Can you provide me the xlsx file in which you got the above stated issue ??

I will help me to track down the bug.

@justkawal justkawal self-assigned this Jun 4, 2020
@justkawal
Copy link
Owner

As you have not replied in a while, I thinks that the issue might be resolved.

If you still gets the issue in reading the xlsx file then don't hesitate to re-open the issue.

Thanks Again
Long Live Open S🔥urce

@marcellocamara
Copy link

marcellocamara commented May 6, 2024

@justkawal I can't read this XLSX
https://servicebus2.caixa.gov.br/portaldeloterias/api/resultados/download?modalidade=Mais-Milionaria
could you figure out what is going on ?

just getting it from an http request, and using the response.bodyBytes to mount the Excel var:

if (response.statusCode == 200) {
      return response.bodyBytes;
...
...
...

final Uint8List bytes = await _getXlsxDataSource(modalityGameName);

final Excel excel = Excel.decodeBytes(bytes);

for (var table in excel.tables.keys) {
   print(table); // Sheet Name
}

Then, the exception is throwed:
Damaged Excel file: Corrupted Excel file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants