You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to load an .xlsx file in order to convert its contents into a list.
I've tied to follow the documentation, yet without success, since the file is not recognized even tough (imo) everything is in place.
I've imported many images and other files and everything works well except that...
I've cleand my flutter and all dependencies work just fine.
The file is in place and not corrupt.
The file is referrenced in the assets section of my pubspec.yaml
My trouble code is (second line): var file = 'assets/database.xlsx'; var bytes = File(file).readAsBytesSync();
import 'package:flutter/services.dart' show ByteData, rootBundle;
/* Your something important code */
ByteData data = await rootBundle.load("assets/database.xlsx");
var bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
var excel = Excel.decodeBytes(bytes, update: true);
Tell me if this works
~Thank You
LONG LIVE OPEN S🔥URCE
Hey all,
I'm trying to load an .xlsx file in order to convert its contents into a list.
I've tied to follow the documentation, yet without success, since the file is not recognized even tough (imo) everything is in place.
I've imported many images and other files and everything works well except that...
I've cleand my flutter and all dependencies work just fine.
The file is in place and not corrupt.
The file is referrenced in the assets section of my pubspec.yaml
My trouble code is (second line):
var file = 'assets/database.xlsx'; var bytes = File(file).readAsBytesSync();
Pubspec:
assets: - assets/database.xlsx
The full error message is:
E/flutter ( 9858): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: FileSystemException: Cannot open file, path = 'assets/database.xlsx' (OS Error: No such file or directory, errno = 2) E/flutter ( 9858): #0 _File.throwIfError (dart:io/file_impl.dart:645:7) E/flutter ( 9858): #1 _File.openSync (dart:io/file_impl.dart:489:5) E/flutter ( 9858): #2 _File.readAsBytesSync (dart:io/file_impl.dart:549:18) E/flutter ( 9858): #3 _MyHomePageState.readExcel (package:prophetix/main.dart:106:28) E/flutter ( 9858): #4 _MyHomePageState.searchDB (package:prophetix/main.dart:121:5) E/flutter ( 9858): <asynchronous suspension> E/flutter ( 9858): #5 SearchBarController._search (package:flappy_search_bar/flappy_search_bar.dart:50:17) E/flutter ( 9858): #6 _SearchBarState._onTextChanged.<anonymous closure> (package:flappy_search_bar/flappy_search_bar.dart:295:29) E/flutter ( 9858): #7 _rootRun (dart:async/zone.dart:1122:38) E/flutter ( 9858): #8 _CustomZone.run (dart:async/zone.dart:1023:19) E/flutter ( 9858): #9 _CustomZone.runGuarded (dart:async/zone.dart:925:7) E/flutter ( 9858): #10 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23) E/flutter ( 9858): #11 _rootRun (dart:async/zone.dart:1126:13) E/flutter ( 9858): #12 _CustomZone.run (dart:async/zone.dart:1023:19) E/flutter ( 9858): #13 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949:23) E/flutter ( 9858): #14 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:23:15) E/flutter ( 9858): #15 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19) E/flutter ( 9858): #16 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5) E/flutter ( 9858): #17 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12) E/flutter ( 9858):
Any help is very appreciated. Thank you for your time!
The text was updated successfully, but these errors were encountered: