excel icon indicating copy to clipboard operation
excel copied to clipboard

How to set CellType.Formula into cell

Open amasahara opened this issue 3 years ago • 2 comments

i try to set cell with fomula like '=Sum(A1:A10)' but seem it not working. only text inside and cannot calculate data in sum column. i see CellType.Formula but don't have any suggestion for using this

amasahara avatar Aug 02 '21 02:08 amasahara

any news ??

Joseph-Nathan avatar May 05 '22 02:05 Joseph-Nathan

To anyone who stumbled upon this like me. (Using the Prerelease: 2.0.0-null-safety-3)

Found it after some trial & error - It is actually quite simpel:

Sheet sheetObject = excel['Sheet1'];
final cellIndex = CellIndex.indexByColumnRow(
  columnIndex: 0,
  rowIndex: 0,
);
sheetObject.updateCell(cellIndex, Formula.custom('YOUR_FORMULA'));

Hope that helps for future reference.

3rpse-ai avatar Jul 18 '22 16:07 3rpse-ai