C# Create Formula SpreadsheetGear API SampleExcel-Compatible Samples for .NET Other C# API SamplesDescriptionCreate a workbook with cell containing a formula using the =RAND() function.Sample C# Source Code// Create a new workbook and some local variables. SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook(); SpreadsheetGear.IWorksheet worksheet = workbook.ActiveWorksheet; SpreadsheetGear.IRange cells = worksheet.Cells; // Set A1 to use the formula =RAND(). cells["A1"].Formula = "=RAND()";