spreadsheet_decoder 1.0.1

Spreadsheet Decoder #

Build Status Coverage Status Pub version

Spreadsheet Decoder is a library for decoding and updating spreadsheets for ODS and XLSX files.

Usage #

On server-side #

import 'dart:io';
import 'package:spreadsheet_decoder/spreadsheet_decoder.dart';

main() {
  var bytes = new File.fromUri(fullUri).readAsBytesSync();
  var decoder = new SpreadsheetDecoder.decodeBytes(bytes);
  var table = decoder.tables['Sheet1'];
  var values = table.rows[0];
  ...
  decoder.updateCell('Sheet1', 0, 0, 1337);
  new File(join(fullUri).writeAsBytesSync(decoder.encode());
  ...
}

On client-side #

import 'dart:html';
import 'package:spreadsheet_decoder/spreadsheet_decoder.dart';

main() {
  var reader = new FileReader();
  reader.onLoadEnd.listen((event) {
    var decoder = new SpreadsheetDecoder.decodeBytes(reader.result);
    var table = decoder.tables['Sheet1'];
    var values = table.rows[0];
    ...
    decoder.updateCell('Sheet1', 0, 0, 1337);
    var bytes = decoder.encode();
    ...
  });
}

Features not yet supported #

This implementation doesn't support following features:

  • annotations
  • spanned rows
  • spanned columns
  • hidden rows (visible in resulting tables)
  • hidden columns (visible in resulting tables)

For XLSX format, this implementation only supports native Excel format for date, time and boolean type conversion. In other words, custom format for date, time, boolean aren't supported and then file exported from LibreOffice as well.

License #

The MIT License, see LICENSE.

1.0.1 #

Fix parsing on converted Numbers documents

1.0.0 #

Dart 2 support

0.4.3 #

Upgrade to xml 3.0.0

0.4.3-alpha #

Add insert/remove columns/rows

0.4.2-alpha #

Add extension getter

0.4.2-alpha #

Add mediaType getter

0.4.0-alpha #

Add updateCell method to update existing cells content

0.3.2 #

Fix string parsing on xlsx file Fix sheet target selection

0.3.1 #

Fix misalignment of decoded value with empty columns

0.3.0 #

Output typed data (number, string, date, time, boolean)

0.2.0 #

Add XLSX decoder

0.1.0 #

Add ODS decoder

0.0.1 #

Initial release

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  spreadsheet_decoder: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:spreadsheet_decoder/spreadsheet_decoder.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
84
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

We analyzed this package on Aug 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:spreadsheet_decoder/spreadsheet_decoder.dart.

Health suggestions

Fix lib/src/spreadsheet.dart. (-2.48 points)

Analysis of lib/src/spreadsheet.dart reported 5 hints:

line 67 col 1: Prefer using /// for doc comments.

line 90 col 70: Use = to separate a named parameter from its default value.

line 90 col 90: Use = to separate a named parameter from its default value.

line 95 col 74: Use = to separate a named parameter from its default value.

line 95 col 94: Use = to separate a named parameter from its default value.

Format lib/src/ods.dart.

Run dartfmt to format lib/src/ods.dart.

Format lib/src/xlsx.dart.

Run dartfmt to format lib/src/xlsx.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and spreadsheet_decoder.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.67.0 <3.0.0
archive ^2.0.0 2.0.10
xml ^3.0.0 3.5.0
Transitive dependencies
args 1.5.2
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.2
meta 1.1.7
petitparser 2.4.0
typed_data 1.1.6
Dev dependencies
path ^1.5.1 1.6.4
test ^1.2.0