Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Silverlight | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

Using the DataTableFormatProvider

The DataTableFormatProvider allows you to easily convert existing DataTable to a worksheet and vice versa. Below you can see how to use this format provider to import/export data tables.

To use the DataTableFormatProvider you need to reference the Telerik.Windows.Documents.Spreadsheet package.

As of Q1 2026 the DataTableFormatProvider supports the timeout mechanism that was previously introduced for the rest of the providers.

Import

Example 1 shows how you can import a DataTable. The sample instantiates a DataTableFormatProvider and passes the table to its Import method.

Example 1: Import DataTable

DataTable table = GetTable(); 
DataTableFormatProvider provider = new DataTableFormatProvider(); 
 
Workbook workbook = provider.Import(table); 
You can import the data from the DataTable to an existing worksheet as well.

Example 2: Import DataTable to an existing Worksheet

DataTable table = GetTable(); 
DataTableFormatProvider provider = new DataTableFormatProvider(); 
 
Workbook workbook = new Workbook(); 
Worksheet worksheet = workbook.Worksheets.Add(); 
 
provider.Import(table, worksheet); 

Export

Example 3 demonstrates how you can export an existing Worksheet to a DataTable. The snippet assumes that you already have a Workbook with some data.

Example 3: Export Worksheet to a DataTable

Workbook workbook = GetWorkbook(); 
DataTableFormatProvider provider = new DataTableFormatProvider(); 
 
DataTable table = provider.Export(workbook.ActiveWorksheet); 

See Also

In this article