MiniExcel icon indicating copy to clipboard operation
MiniExcel copied to clipboard

write formula to Excel, formula treated as string

Open EanLee opened this issue 1 year ago • 1 comments

Excel Type

  • [x] XLSX
  • [ ] XLSM
  • [ ] CSV
  • [ ] OTHER

Upload Excel File

image

MiniExcel Version

1.34.1

Description

When you directly output formulas to an Excel file using MiniExcel, and then save it as a new file, the cells containing the formulas are treated as regular data, and the formulas themselves do not work. The formulas only become active after you manually enter the cells, edit the formulas, and press Enter.

And, I can’t find the relevant settings and instructions in the instructions for use in the readme.


var data = new List<Dictionary<string, object>>
{
    new Dictionary<string, object>
    {
        ["Institution"] = "Institution",
        ["Created"] = "Created",
        ["Formula"] = "Formula",
    },
    new Dictionary<string, object>
    {
        ["Institution"] = "BMC Inc.",
        ["Created"] = "2021-01-01",
        ["Formula"] = $"=SUM(A2:B2)"
    },
};

MiniExcel.SaveAs("test.xlsx", data, printHeader: false, overwriteFile: true, excelType: ExcelType.XLSX);

EanLee avatar Aug 31 '24 02:08 EanLee

Functionality waiting for Pull Request. PR 679: Formula Support

RaZer0k avatar Oct 15 '24 14:10 RaZer0k