WorkBook workbook1 = WorkBook.Load("data.xlsx");
WorkSheet sheet1 = workbook1.WorkSheets.First();
//This is how we get range from Excel worksheet
Range range = sheet1["A2:E10"];
//Sort the range in the sheet
range.SortAscending();
workbook1.SaveAs("data.xlsx");
////////////////
////////////
// set a formula
sheet1["A1"].Value = "=SUM(A2:A10)";
//get the calculated value
decimal sum = sheet1["A1"].DecimalValue;
textBox1.AppendText(sum.ToString());
textBox1.AppendText("\r\n");
sheet1["A11"].Value = sum;
workbook1.SaveAs("yydata.xlsx");
//////////////////////