buildExcel method
Implementation
Future<Uint8List?> buildExcel(List<String> keys, List<List<dynamic>> values, {String? sheetName} ) async {
try {
var excel = Excel.createExcel();
Sheet sheetObject = excel[sheetName ?? 'Sheet1'];
sheetObject.appendRow(keys); // Agregar encabezados
for (var value in values) { sheetObject.appendRow(value); } // agregar filas
List<int>? bytes = excel.encode(); // Guardar archivo en almacenamiento temporal
if (bytes == null) throw 'base64 null';
return Uint8List.fromList(bytes);
} catch (e) {
throw 'buildExcel: ${e.toString()}';
}
}