parseBytes static method

List<List> parseBytes(
  1. Uint8List bytes,
  2. SheetType type, {
  3. String? sheetName,
  4. int? sheetIndex,
})

Parse bytes into rows based on type

bytes - The raw bytes to parse type - The file type sheetName - For Excel files, the specific sheet name to parse sheetIndex - For Excel files, the sheet index (default: 0)

Returns a list of rows, where each row is a list of cell values

Implementation

static List<List<dynamic>> parseBytes(
  Uint8List bytes,
  SheetType type, {
  String? sheetName,
  int? sheetIndex,
}) {
  if (type.isExcel) {
    return ExcelParser.parse(
      bytes,
      type,
      sheetName: sheetName,
      sheetIndex: sheetIndex,
    );
  } else if (type.isTextBased) {
    return CsvParser.parse(bytes, type);
  } else {
    throw Exception('Unsupported sheet type: $type');
  }
}