# Calculate Formula while Assembling Spreadsheet Documents Recalculate worksheet formulas and fields while a spreadsheet report is assembled: the UpdateFieldsAndFormulas option in GroupDocs.Assembly for .NET, with C# code. {{< alert style="info" >}}This feature is only compatible with GroupDocs.Assembly for .NET 3.3.0 or later releases.{{< /alert >}}{{< alert style="info" >}}The code uses some of the objects defined in [The Business Layer](https://docs.groupdocs.com/assembly/net/the-business-layer/).{{< /alert >}} ### The Recipe * Set up the source document template path * Set up destination report path * Instantiate DocumentAssembler class * Set options, [DocumentAssemblyOptions.UpdateFieldsAndFormulas](https://reference.groupdocs.com/net/assembly/groupdocs.assembly/documentassemblyoptions) * Generate report ### Download Template Get the template from here. * [Update-Fomula.xlsx](https://github.com/groupdocs-assembly/GroupDocs.Assembly-for-.NET/blob/master/Examples/Data/Source/Spreadsheet%20Templates/Update-Fomula.xlsx?raw=true) ### The Code {{< gist GroupDocsGists 8b52aa31a79fa631c3b75efb29d11507 >}} Why an aggregate over a repeating row belongs in the template rather than in a worksheet formula: [Generate Excel reports from a template]({{< ref "/assembly/net/use-cases/generate-excel-reports-from-template.md" >}}).