Comments (11)
I think this may help:
use:
eachRow(index,row) { List<String> dataList = [index.toString(), row['area']]; sheetObject.insertRowIterables(dataList, index+1);}
call this to populate data in loop:
maps.asMap().forEach((index,row) => eachRow(index,row));
from excel.
Thanks a lot.
Regarding insertRowIterables, I thought I insert a data in row-0, that will shift 0 to 1. I insert again a data to row-0, that will shift 1 to 2, 0 to 1. Isn't it? Thus, you called it "insert", not "update" nor "overwrite". Do I misunderstand?
from excel.
Thanks, I tried your way with map conversion but same. It's however added extra several null if use insertRowIterables.
from excel.
It's great package, thanks for contribution.
Herein I would like report an issue there is no way to insert a row. Both insertRow and insertRowIterables are failed.
- insertRow will cause the sheetObject crash, everything behind the index will be gone.
- insertRowIterables will overwrite the index's row. And on the row, the length is double with same length of "null".
Could you please check it? Or if you need a sample code for reproducing issue, I can make it. Please let me know.
Please provide a code to reproduce the issue.
from excel.
It's great package, thanks for contribution.
Herein I would like report an issue there is no way to insert a row. Both insertRow and insertRowIterables are failed.
- insertRow will cause the sheetObject crash, everything behind the index will be gone.
- insertRowIterables will overwrite the index's row. And on the row, the length is double with same length of "null".
Could you please check it? Or if you need a sample code for reproducing issue, I can make it. Please let me know.
I have tested the code,
It seems to be working good to me.
I would love to get the code for which u are getting any issue, So that I know that which corner cases I might have missed.
If you would not prefer disclosing it here, then you can mail me on [email protected]
from excel.
@justkawal Thanks for support. Please refer the code below:
The code I insert a list with 5 data. But look at the log, it's 5 data + 5 null. And I pressed 3 times, that should be supposedly accumulated three rows but not.
[*** Source code as below ***]
import 'package:flutter/material.dart';
import 'package:excel/excel.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Excel excel;
Sheet sheetObject;
@override
void initState() {
super.initState();
excel = Excel.createExcel();
sheetObject = excel["sheet1"];
}
void _incrementCounter() {
print("Press Button");
sheetObject.insertRowIterables(['2020-09-25','A','B','C','D'], 0);
for (var row in sheetObject.rows) {
print("length:${row.length} => $row");
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
child: Icon(Icons.add),
),
);
}
}
[*** Printed Result as below ***]
Restarted application in 1,241ms.
I/flutter (16419): Press Button
I/flutter (16419): length:10 => [2020-09-25, A, B, C, D, null, null, null, null, null]
I/flutter (16419): Press Button
I/flutter (16419): length:10 => [2020-09-25, A, B, C, D, null, null, null, null, null]
I/flutter (16419): Press Button
I/flutter (16419): length:10 => [2020-09-25, A, B, C, D, null, null, null, null, null]
from excel.
Hey bro,
You are inserting the iterables onto the same row again and again
As you are passing a 0 as rowIndex in sheetObject.insertRowIterables(['2020-09-25','A','B','C','D'], 0);
void _incrementCounter() {
print("Press Button");
sheetObject.insertRowIterables(['2020-09-25','A','B','C','D'], 0);
for (var row in sheetObject.rows) {
print("length:${row.length} => $row");
}
}
If you want to append the rows one after the another, there is a method named as appendRow
void _incrementCounter() {
print("Press Button");
sheetObject.appendRow(['2020-09-25', 'A', 'B', 'C', 'D']);
for (var row in sheetObject.rows) {
print("length:${row.length} => $row");
}
}
I hope your issue is resolved now !!
Long Live Open Source
~Kawal
from excel.
I thinks there is one issue with null thing it is doubled everytime
I will check on it and will provide an update in a day or two.
from excel.
Hi @justkawal thanks for fixing the issue. Could you teach me how to adopt your fixes in pubspec.yaml file?
from excel.
By tomorrow, I'll be releasing new version with more features and bugs resolved.
from excel.
@justkawal Thank you!
I checked the Flutter pub.dev, but there is still 1.1.5. May I know when you will publish to Flutter pub.dev package?
from excel.
Related Issues (20)
- Help: Determining the type of a cell HOT 1
- How to use custom Chinese fonts
- Excel - Roadmap Tasks HOT 2
- Default constructors for simplicity
- rename sheet breaks with archive 3.4.10 HOT 1
- Excel.decodeBytes -> Bad State too many elements
- The argument type 'String' can't be assigned to the parameter type 'ExcelColor' HOT 4
- How to parse Excel cell merging information?
- Bug reading SpannedItems as empty HOT 2
- README.md demo doesn't compile since 4.0.3 update
- Couldn't decode ".xls" file HOT 1
- Cannot delete sheets HOT 6
- DateTimeCellValue not working on Windows
- Very inefficient RAM usage HOT 2
- Can't read the XLSX file from http request - Damaged Excel file: Corrupted Excel file HOT 1
- How to save .csv
- Bad state: No element while parsing
- Can I select the sheet I want to open in a file that has multiple sheets?
- update package HOT 5
- Cells with a time below `02:25:00` are recognized as `DateTimeCellValue` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from excel.