excel_kit

Last updated:

0 purchases

excel_kit Image
excel_kit Images
Add to Cart

Description:

excel kit

ExcelKit #
An easy-to-use excel kit.
Getting started #
1. Depend on it #
Add this to your package's pubspec.yaml file:
dependencies:
excel_kit: 0.0.1
copied to clipboard
2. Install it #
You can install packages from the command line:
with pub:
$ pub get
copied to clipboard
with Flutter:
$ flutter packages get
copied to clipboard
3. Import it #
Now in your Dart code, you can use:
import 'package:excel_kit/excel_kit.dart';
copied to clipboard
Usage #
Read xlsx file: #
String readPath = path.canonicalize(path.join(path.current, "test/resource/read_test.xlsx"));

Map<String, String> fieldMap = {
"id": "ID",
"name": "Name",
"age": "Age",
};

// get sheet content
var sheet = ExcelKit.readFile(readPath).getSheet("Sheet1", fieldMap: fieldMap);

// get title list
var fieldList = sheet.getFieldList();
print(jsonEncode(fieldList));

// get data list
var dataList = sheet.getDataList();
print(jsonEncode(dataList));
copied to clipboard
print:
title: ["ID","Name","Age"]
data: [{"id":1,"name":"user1","age":12},{"id":2,"name":"user2","age":15}]
copied to clipboard
Write xlsx file: #
String writePath = path.canonicalize(path.join(path.current, "test/resource/write_test.xlsx"));

List<Map> dataList = [
{
"id": 1,
"name": "user1",
"age": 12
},
{
"id": 2,
"name": "user2",
"age": 15
}
];

Map<String, String> fieldMap = {
"id": "ID",
"name": "Name",
"age": "Age",
};

ExcelKit.writeFile(writePath, [SheetOption("Sheet1", dataList, fieldMap: fieldMap)]);
copied to clipboard
Special Thanks #
Thanks for justkawal/excel.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.