--- title: "Add Totals Row using SQL Spreads" slug: "adding-a-totals-row-to-the-excel-table" description: "Add a totals row above the Excel table rather than below it, because SQL Spreads clears everything below the table when data is refreshed." updated: 2023-09-22T08:13:16Z published: 2023-09-22T08:13:16Z canonical: "sqlspreads.com/adding-a-totals-row-to-the-excel-table" --- > ## Documentation Index > Fetch the complete documentation index at: https://sqlspreads.com/docs/llms.txt > Use this file to discover all available pages before exploring further. # How to Add a Totals Row to an Excel Table Refreshed from SQL Server ## How to Add a Totals Row to an Excel Table Synced with SQL Server SQL Spreads clears all data below the Excel table when the data is refreshed from the SQL Server table. This will have the effect that summary rows will also be deleted. To add a Totals row, we recommend that you add a section above the Excel table and add your Total rows there: ![image.png](https://cdn.document360.io/ad9d65b3-9cdd-4b28-8cb8-86cb149873bc/Images/Documentation/image%28127%29.png) When you add your summary formula, reference the data using an Excel table column reference as in the example below: ![image.png](https://cdn.document360.io/ad9d65b3-9cdd-4b28-8cb8-86cb149873bc/Images/Documentation/image%28128%29.png) You can copy the formula from here: ``` =SUBTOTAL(9;Table2[Amount]) ```