# Modify Tables

DsExcel allows you to modify table range, table areas, and totals row of table column.

## Content

While working with tables in DsExcel .NET, you can configure it as per your spreadsheet requirements by modifying the table using the properties and methods of the [ITable interface](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.ITable.html).

* [Modify table range](/document-solutions/dot-net-excel-api/docs/online/Features/UseTable/ModifyTables#modify-table-range)
* [Modify table areas](/document-solutions/dot-net-excel-api/docs/online/Features/UseTable/ModifyTables#modify-table-areas)
* [Modify totals row of table column](/document-solutions/dot-net-excel-api/docs/online/Features/UseTable/ModifyTables#modify-totals-row-of-table-column)

## Modify table range

DsExcel .NET allows you to modify the table range of your worksheet using the [Resize method](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.ITable.Resize.html) of the ITable interface.
Refer to the following example code to modify table range.

```csharp
//Modify table range
table.Resize(worksheet.Range["B1:E4"]);
```

## Modify table areas

You can modify the value of specific table areas by accessing its header range, data range and total range using the [HeaderRange property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.ITable.HeaderRange.html), [DataRange property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.ITable.DataRange.html) and [TotalsRange property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.ITable.TotalsRange.html) of the ITable interface.
Refer to the following example code to modify table areas in your worksheet.

```csharp
ITable table = worksheet.Tables.Add(worksheet.Range["A1:E5"], true);
table.ShowTotals = true;

//Populate table values           
worksheet.Range["A2"].Value = 3;
worksheet.Range["A3"].Value = 4;
worksheet.Range["A4"].Value = 2;
worksheet.Range["A5"].Value = 1;
worksheet.Range["B2"].Value = 32;
worksheet.Range["B3"].Value = 41;
worksheet.Range["B4"].Value = 12;
worksheet.Range["B5"].Value = 16;
worksheet.Range["C2"].Value = 3;
worksheet.Range["C3"].Value = 4;
worksheet.Range["C4"].Value = 15;
worksheet.Range["C5"].Value = 18;

//Table second column name set to "Age".
worksheet.Tables[0].HeaderRange[0, 1].Value = "Age";

//"Age" Column's second row's value set to 23.
worksheet.Tables[0].DataRange[1, 1].Value = 23;

//"Age" column's total row function set to average.
worksheet.Tables[0].TotalsRange[0, 1].Formula = "=SUBTOTAL(101,[Age])";
```

## Modify totals row of table column

When you need to make changes to the total row's calculation function of a specific table column, you can use the [TotalsCalculation property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.ITableColumn.TotalsCalculation.html) of the [ITableColumn interface](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.ITableColumn.html).
Refer to the following example code to modify column total row's calculation function.

```csharp
worksheet.Tables.Add(worksheet.Range["A1:C5"], true);
worksheet.Tables[0].ShowTotals = true;

//Populate table values           
worksheet.Range["A2"].Value = 3;
worksheet.Range["A3"].Value = 4;
worksheet.Range["A4"].Value = 2;
worksheet.Range["A5"].Value = 1;
worksheet.Range["B1"].Value = 13;
worksheet.Range["B2"].Value = 32;
worksheet.Range["B3"].Value = 41;
worksheet.Range["B4"].Value = 12;
worksheet.Range["B5"].Value = 16;
worksheet.Range["C1"].Value = 1;
worksheet.Range["C2"].Value = 3;
worksheet.Range["C3"].Value = 4;
worksheet.Range["C4"].Value = 15;
worksheet.Range["C5"].Value = 18;

//First table column's total row calculation fuction will be "=SUBTOTAL(101,[Column1])"
worksheet.Tables[0].Columns[1].TotalsCalculation = TotalsCalculation.Count;
```