excel
excel copied to clipboard
Can't read the XLSX file from http request - Damaged Excel file: Corrupted Excel file
I can't read this xlsx file, obtained from an http request: https://servicebus2.caixa.gov.br/portaldeloterias/api/resultados/download?modalidade=Mais-Milionaria
Example code:
final response = await get(
Uri.parse("https://servicebus2.caixa.gov.br/portaldeloterias/api/resultados/download?modalidade=Mais-Milionaria"),
);
if (response.statusCode == 200) {
final Excel excel = Excel.decodeBytes(response.bodyBytes);
for (var table in excel.tables.keys) {
print(table); // Sheet Name
}
}
It throws the following exception when trying to print the table name:
Damaged Excel file: Corrupted Excel file.
I've created an example app: https://github.com/marcellocamara/issues/blob/master/Flutter3Excel/lib/main.dart