excel
excel copied to clipboard
After Processing 2 files with different data its mixed and shows wrong data (probably caching problem)
I have 2 different excel file with different columns and fields i want to export excel data as 2 dimension list for each row a list of data the progress works fine first time for first excel but after switching between excel and do the same process the data is mixed up and shows some mixture of both columns and data of files i attach 2 file for example
ExcelFlight.xlsx ExcelPax.xlsx
if i print result of my process for first excel for first time its is something like this: (values are separated with '|' and each row is printer in separate line)
FLNB|Airline|Registration|FlightDate|FromCity|ToCity|STD|BTD|Duration|STA|Gate|IsTest|International
2999|ZZ|ZZ-TEST|2021-09-05T01:00:00.000|CDG|LAX|19:40:00|18:30:00|01:00:00|20:00:00|9|0|0
4000|AC|C-GHCZ|2021-09-05T01:00:00.000|BCN|YVR|21:10:00|20:35:00|01:10:00|22:40:00|7|1|0
3999|ZZ|J-TEST|2021-09-05T01:00:00.000|CDG|LAX|13:09:59|12:15:00|02:00:00|20:00:00|8-11|0|0
and for the second one if i restart app and do process for this one first its as follows:
LastName|FirstName|PaxType|Title|ReferenceNo|TicketNo|NationalID
Test|Test|ADL|MR|YYYYY|1111111111|9999999999
Test2|Test2|CHD|MS|YYYYY|1111111112|8888888888
Test3|Test3|INF|MR|YYYYY|1111111113|7777777777
but after repeating the process and switch the file (using file picker) the result with be something mixed up like follow:
LastName|FirstName|ToCity|PaxType|Title|ReferenceNo|TicketNo|NationalID|Test|ADL|MR|YYYYY|Test2
2999|MS|STD|2021-09-05T01:00:00.000|INF|FLNB|19:40:00|18:30:00|01:00:00|20:00:00|9|0|0
4000|Test3|FromCity|2021-09-05T01:00:00.000|Airline|FlightDate|21:10:00|20:35:00|01:10:00|22:40:00|CHD|1|0
3999|MS|Duration|2021-09-05T01:00:00.000|INF|FLNB|13:09:59|12:15:00|02:00:00|20:00:00|BTD|0|0
as you can see its broken, i just repeat same process with the first excel again i guess there is some caching that make thing like this happen
and the code for generating mentioned lines are as follows:
File f = File(pickerFile.files.first.path.toString());
List<int> bytes = f.readAsBytesSync();
Excel excel = Excel.decodeBytes(bytes);
excel.sheets.values.first.rows.forEach((row) {
String rowStr = row.map((e) => "${e!.value}").join("|");
print(row.map((e) => "${e!.value}").join("|"));
print("\n");
});
i even tried to delete file after each process using following code but it did not work
await f.delete();
bytes = [];
@MahmoodBakhshayesh did you find a solution about this? I encounter the exact same problem.
#111 Similar to this where int coming out as String (in DateTime format)
@MahmoodBakhshayesh @ilourt @SlickSlime
Hey, are you still experiencing this issue on the latest version 2.0.1
?
I couldn't reproduce it on my part...
@FauconSpartiate honestly I can't tell you as I had to find another solution (my previous comment is 1 year old). If in another project I try the v2, I will let you know if I encounter the problem again.