New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to update the excel cell as Number instead of text. #26
Comments
This feature isn't available yet. The code that manages this is here. I won't have time to implement now. |
@sestegra according to you is probably more related to https://github.com/sestegra/spreadsheet_decoder/blob/master/lib/src/xlsx.dart#L558 ;)
This produces an output like described in http://officeopenxml.com/SScontentOverview.php
But excel can not handle it. |
Hey @sestegra could you throw me a 🦴 and send me into right direction. Unfortunately I am pretty stuck right now 😕 |
Facing same issue... |
Hey @MalikSamiAwan no unfortunately I had no time to dig in any further but let me know if you have more luck. |
Hi ,
I am trying to save some values in the excel sheet as numbers that will later be used in Formulas. I am using SpreadsheetDecoder in Dart . The problem is , I am able to save the data , but the data saved is in Text format and so it being text i am not able to use in Formula that need Number. The code I am using is provided below.
import 'dart:io';
import 'dart:typed_data';
import 'package:path/path.dart';
import 'package:spreadsheet_decoder/spreadsheet_decoder.dart';
File file = File('FileToUpdate.xlsx');
List requiredRow;
SpreadsheetDecoder decoder;
Uint8List bytes;
/*
Row number (rowNum) for various values in excel sheet
'aValue':14 , int
'bValue':15 int
'cValue':16 double
*/
int rowNum = 14;
int newValue = 5;
void main(List args) {
bytes = file.readAsBytesSync();
decoder = SpreadsheetDecoder.decodeBytes(bytes, update: true);
final table = decoder.tables['SheetName'];
requiredRow = table.rows[rowNum];
var requiredValue = requiredRow[0] as String;
print(requiredValue);
setValue(newValue);
final valueStored = getValue();
print(valueStored);
}
void setValue(int value) {
decoder.updateCell('SheetToUpdate', 1, rowNum, value);
File(join('FileToUpdate.xlsx'))
..createSync(recursive: true)
..writeAsBytesSync(decoder.encode());
}
String getValue() {
String returnValue = requiredRow[1].toString();
return returnValue;
}
The text was updated successfully, but these errors were encountered: