Skip to main content

excel_to_json 2.0.0 copy "excel_to_json: ^2.0.0" to clipboard
excel_to_json: ^2.0.0 copied to clipboard

Convert Excel (.xlsx) and CSV spreadsheets to JSON or Dart maps, in pure Dart. Formula results, dates, merged cells, any header row.

example/excel_to_json_example.dart

// Converts an .xlsx or .csv file to JSON and prints it.
//
//   dart run example/excel_to_json_example.dart people.xlsx
import 'dart:io';

import 'package:excel_to_json/excel_to_json.dart';

void main(List<String> args) {
  if (args.length != 1) {
    stderr.writeln(
      'usage: dart run example/excel_to_json_example.dart <file.xlsx|file.csv>',
    );
    exitCode = 64;
    return;
  }

  try {
    final bytes = File(args.single).readAsBytesSync();
    stdout.writeln(const ExcelToJson().toJson(bytes));
  } on FileSystemException catch (e) {
    stderr.writeln('Could not read ${args.single}: ${e.message}');
    exitCode = 66;
  } on ExcelToJsonException catch (e) {
    stderr.writeln(e.message);
    exitCode = 65;
  }
}
24
likes
160
points
723
downloads
screenshot

Documentation

API reference

Publisher

verified publishervitormelo.dev.br

Weekly Downloads

Convert Excel (.xlsx) and CSV spreadsheets to JSON or Dart maps, in pure Dart. Formula results, dates, merged cells, any header row.

Repository (GitHub)
View/report issues
Contributing

Topics

#excel #json #csv #spreadsheet #xlsx

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

archive, xml

More

Packages that depend on excel_to_json