sestegra/spreadsheet_decoder

Flutter Web: not able to read Excel file

VarmaTech opened this issue · 2 comments

HI ,
I am trying to read rows from excel file which in selected from Html page and give to spreadsheet decoder , but nothing is come later .

Step1 : this how i got file .
InputElement uploadInput = FileUploadInputElement();
uploadInput.click();
uploadInput.multiple = false;
uploadInput.draggable = true;
uploadInput.onChange.listen((e) {
// read file content as dataURL
final files = uploadInput.files;
final file = files[0];
});

Step 2 :

final reader = new FileReader();
reader.onLoadEnd.listen((e) {
var bytes = reader.result;

Logs.debug("process 1");
var decoder = Excel.decodeBytes(bytes, verify: true);
// FROM HERE NOTHING ,
Logs.debug("process 2");
print("************************************************************");
for (var table in decoder.tables.keys) {
Logs.debug(table);
Logs.debug("${decoder.tables[table].maxCols}");
Logs.debug("${decoder.tables[table].maxRows}");
for (var row in decoder.tables[table].rows) {
Logs.debug("$row");
}
}
});
reader.readAsDataUrl(file);

after the log "process1" nothing is happening,

please help me out

First, check the result of bytes.

var bytes = reader.result;
print(bytes);

Then, Excel class doesn't exist in this package.

@VarmaTech i have the same problem, how did you solve it?