-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
error when reading worksheets, the indexes of the columns read in dart do not match excel, it is as if the columns change order randomly #159
Comments
The Lib is experiencing errors when importing the data, shuffling the information displaying in incorrect order. |
same problem here |
Sorry for the trouble. |
version 2.0.1 has the problem |
i am working on a project to extract some data from an excel file, when the project was almost done i noticed that some rows had "shifted" the array one step and was giving me the data from the wrong cell. I have tried changeing the data in the excel file, changed the order of the rows but it just wont give me the correct data, at this point i dont know how to proceed. Is there a another package i can try? |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
@FauconSpartiate @justkawal @take4blue any updates? |
Nope, but any help from anyone that is motivated is welcome 👍 |
@YancyHsu @insinfo @danielR2001 @youssefhegab14 @marcoredz @navyzhou926 @DaKar00 @ldsouza93 I managed to reproduce the error with the test file on the original comment, but only on |
Closing, as this has been fixed. |
I just did a test with version 3.0.0 and it seems to be working correctly now import 'dart:io';
import 'package:excel/excel.dart';
import 'package:http/http.dart' as http;
void main(List<String> args) async {
final url =
'https://github.com/justkawal/excel/files/8808016/AUTO.DE.INFRACAO.e.AUTO.DE.CONSTATACAO.xlsx';
final resp = await http.get(Uri.parse(url));
final bytes = resp.bodyBytes;
final excel = Excel.decodeBytes(bytes);
final worksheetsNames = excel.tables.keys;
for (var sheetName in worksheetsNames) {
if (sheetName == 'AUTO DE INFRACAO') {
final sheet = excel.tables[sheetName]!;
final sheetRows = sheet.rows;
final rowsLength = sheetRows.length;
for (var idx = 0; idx < rowsLength; idx++) {
final row = sheetRows[idx];
// print(" ${row.map((e) => '${e?.value}').join(' | ')}");
print(
'${row[0]?.value} | ${row[1]?.value} | ${row[2]?.value} | ${row[3]?.value} | ${row[4]?.value} | ${row[5]?.value} | ${row[6]?.value} | ${row[7]?.value} | ${row[8]?.value}');
}
break;
}
}
exit(0);
}
|
error when reading spreadsheets, the indexes of the columns read in dart do not match excel, which makes it impossible to import to the database because there is inconsistency, it is as if the columns change order randomly.
given this worksheet.
AUTO DE INFRACAO e AUTO DE CONSTATACAO.xlsx
the reading result is this: see that the columns do not match
the column with the value "ENEL" was supposed to be in index 2 but to be in index 4, there is also a confusion regarding row data appearing in the wrong row and wrong column.
The text was updated successfully, but these errors were encountered: