excel_it 1.0.5 copy "excel_it: ^1.0.5" to clipboard
excel_it: ^1.0.5 copied to clipboard

discontinued

A flutter and dart library for creating, editing and updating excel sheets with compatible both on client and server side.

example/excel_it.dart

import 'dart:io';
import 'package:path/path.dart';
import 'package:excel_it/excel_it.dart';

void main(List<String> args) {
  var file = "/Users/Desktop/excel.xlsx";
  var bytes = File(file).readAsBytesSync();
  var decoder = ExcelIt.decodeBytes(bytes, update: true);

  for (var table in decoder.tables.keys) {
    print(table);
    print(decoder.tables[table].maxCols);
    print(decoder.tables[table].maxRows);
    for (var row in decoder.tables[table].rows) {
      print("$row");
    }
  }

  // if [Sheet24] does not exist then it will be automatically created.
  var sheet = 'Sheet24';

  decoder
    ..updateCell(sheet, CellIndex.indexByString("A1"), "A1",
        fontColorHex: "#1AFF1A", verticalAlign: VerticalAlign.Top)
    ..updateCell(
        sheet, CellIndex.indexByColumnRow(columnIndex: 2, rowIndex: 0), "C1",
        wrap: TextWrapping.WrapText)
    ..updateCell(sheet, CellIndex.indexByString("A2"), "A2",
        backgroundColorHex: "#1AFF1A")
    ..updateCell(sheet, CellIndex.indexByString("E5"), "E5",
        horizontalAlign: HorizontalAlign.Right);

  decoder.encode().then((onValue) {
    File(join("/Users/kawal/Desktop/excel_out.xlsx"))
      ..createSync(recursive: true)
      ..writeAsBytesSync(onValue);
  }).then((_) {
    print(
        "\n****************************** Printing Updated Data Directly by reading output file ******************************\n");
    var fileOut = "/Users/Desktop/excel_out.xlsx";
    var bytesOut = File(fileOut).readAsBytesSync();
    var decoderOut = ExcelIt.decodeBytes(bytesOut, update: true);

    for (var table in decoderOut.tables.keys) {
      print(table);
      print(decoderOut.tables[table].maxCols);
      print(decoderOut.tables[table].maxRows);
      for (var row in decoderOut.tables[table].rows) {
        print("$row");
      }
    }
  });
}
9
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A flutter and dart library for creating, editing and updating excel sheets with compatible both on client and server side.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

archive, xml

More

Packages that depend on excel_it