SetArrayFormula for a Range

How to use SetArrayFormula on a Range representing multiple rows & columns?

@harshaghanta,

Thanks for your query.

You can use “SetArrayFormula” on a range as below code snippet:

Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
sheet.Cells[0, 0].PutValue(10);
sheet.Cells[1, 0].PutValue(20);
sheet.Cells[2, 0].PutValue(30);
sheet.Cells[3, 0].PutValue(40);
sheet.Cells[4, 0].PutValue(50);
sheet.Cells[5, 0].PutValue(60);
sheet.Cells[6, 0].PutValue(70);
sheet.Cells[7, 0].PutValue(80);
sheet.Cells[8, 0].PutValue(90);
sheet.Cells[9, 0].SetArrayFormula("=SUM( A1: A8 ) ", 1, 1);
workbook.CalculateFormula();
workbook.Save(outputPath, SaveFormat.Xlsx);