Not able to decode large file of Excel data in Flutter

Viewed 11

When I try to Import Large File of Excel It's Giving Error but It's Working in less than 2k data

When I Debug I Found This Error here

var bytes = await File(file).readAsBytes();

It's Taking Too much Time to decode in Uint8List

/data/user/0/com.example.flutter_file_reader/cache/file_picker/myAssetList.xlsx

[log] FormatException: Could not find End of Central Directory Record
 //Decording Excel
importFromExcel(String fileLocation) async {
  List rowdetail = [];
  try {
    List<List<dynamic>> _listData = [];
    var file = fileLocation;
    log(file);
    var bytes = await File(file).readAsBytes();
    // log(bytes.toString());
    var excel = Excel.decodeBytes(bytes);
    for (var table in excel.tables.keys) {
      for (var row in excel.tables[table]!.rows) {
        for (var i = 0; i < row.length; i++) {
          rowdetail.add(row[i]?.value.toString());
        }
        _listData.add(rowdetail);
        rowdetail = [];
      }
    }
    return _listData;
  } catch (e) {
    log(e.toString());
  }
}
0 Answers
Related