Passer au contenu du pied de page
UTILISATION D'IRONXL

Comment convertir une table en plage dans Excel

An Excel table provides a list of features that are used to effectively analyze and manage data, such as auto-filter and sort options, total row, calculated columns, table style, automatic expansion, etc.

The screenshot below shows a difference between a normal range and a table style formatting:

How to Convert Table to Range in Excel - Figure 1: Normal Range
How to Convert Table to Range in Excel - Figure 2: Table Format

This tutorial will demonstrate how to convert an Excel table to a range.

How to Create a Table?

There are many ways to create or convert a range to a table range in Excel. To insert a table in Excel, click any single cell within your data set, and do any of the following:

  1. On the Insert menu tab, in the Tables section group, click the Table option. A default style table will be inserted.

    How to Convert a Table to a Range in Excel, Figure 3: Insert a New Table in Excel with Default Styles Insert a New Table in Excel with Default Styles

  2. On the Home menu tab, in the Styles section group, click Format as Table, and select one of the predefined table styles. You can choose any banded rows style.

    How to Convert a Table to a Range in Excel, Figure 4: Apply a predefined format to an existing Excel spreadsheet table Apply a predefined format to an existing Excel spreadsheet table

  3. Another option and the fastest way to create an Excel table is by pressing the keyboard shortcut: Ctrl + T.

Whichever method you choose, the Create Table dialog box appears. Excel automatically selects the data range. Verify the selected range, then check/uncheck the "My table has headers" option, and click OK.

How to Convert a Table to a Range in Excel, Figure 5: Format the Table with Excel preselected style Format the Table with Excel preselected style

As a result, a nicely formatted table is created in the worksheet.

The filter arrows allow us to filter and sort the data in the table based on your criteria. While scrolling, the column headers box is visible. New data can be included using automatic table expansion, Quick totals, Calculating table data with ease are some prominent table features.

Now we know how to convert a regular range of cells to a table style. At some point, we might need to remove table formatting and convert the table to a normal range without losing any data and formulas. So let's have a look at how to convert an Excel table to a range.

How to Convert Table Style to a Normal Range?

There are two ways to convert a table to a cell range in Excel.

If you want to remove a table without losing the table data, table formatting, or structured references, you can follow the below steps:

  1. Go to the Table Design tab under Table Tools > Tools group, and click Convert to Range.

    How to Convert a Table to a Range in Excel, Figure 6: Converting a Styled Table into a Normal Range using the Menu Bar options Converting a Styled Table into a Normal Range using the Menu Bar options

  2. Alternatively, right-click anywhere within the table, and click Table > Convert to Range.

    How to Convert a Table to a Range in Excel, Figure 7: Converting a Styled Table into a Normal Range using the Context Menu Converting a Styled Table into a Normal Range using the Context Menu

This is how you can convert the data of a table to a range. Notice that the arrows are removed from the range but the data and formatting are preserved.

How to Convert a Table to a Range in Excel, Figure 8: The appearance of the spreadsheet data, after being converted back to a Normal range The appearance of the spreadsheet data, after being converted back to a Normal range

The IronXL C# Library

IronXL is a .NET library that facilitates reading and editing Microsoft Excel documents with C# without Microsoft Excel or Interop. IronXL can read and manipulate Excel files with accuracy and fast performance. It supports all .NET components, along with platforms such as Android, Xamarin, Linux, Azure, AWS, macOS, Docker, and MAUI.

With a few lines of code, developers can perform all Excel-related tasks without any complication. These tasks include adding two cells, adding rows and columns of data to Excel tables, and applying functions across rows and columns, among others.

IronXL Feature Set

  • Load, read, and edit data — from XLS/XLSX/CSV/TSV
  • Saving and exporting — to XLS/XLSX/CSV/TSV/JSON
  • System.Data Objects — work with Excel Spreadsheets as System.Data.DataSet and System.Data.DataTable objects.
  • Formulas — works with Excel formulas. Formulas get recalculated whenever the sheet is edited.
  • Ranges — easy to use ["A1:B10"] syntax.
  • Sorting — it can sort rows, columns, and ranges within a table or normal range.
  • Styling — font, font size, cell style, alignments, background color, and many more styling options are available.

Below are some code examples of C# code to manipulate Excel files:

using IronXL;

public class ExcelExample
{
    public static void Main()
    {
        // Load an existing Excel workbook
        WorkBook workbook = WorkBook.Load("test.xlsx");

        // Choose the default worksheet in the workbook
        WorkSheet worksheet = workbook.DefaultWorkSheet;

        // Set formulas for various cells
        worksheet["A1"].Formula = "SUM(B8:C12)"; // Sum cells B8 to C12
        worksheet["B8"].Formula = "=C9/C11"; // Divide value in C9 by value in C11
        worksheet["G30"].Formula = "MAX(C3:C7)"; // Find the maximum value from cells C3 to C7

        // Force recalculating all formulas in all sheets
        workbook.EvaluateAll();

        // Retrieve calculated value from a cell
        string formulaValue = worksheet["G30"].Value.ToString(); // e.g., 52

        // Retrieve the formula as a string from a cell
        string formulaString = worksheet["G30"].Formula; // e.g., "MAX(C3:C7)"

        // Save changes with updated formulas and calculated values
        workbook.Save();
    }
}
using IronXL;

public class ExcelExample
{
    public static void Main()
    {
        // Load an existing Excel workbook
        WorkBook workbook = WorkBook.Load("test.xlsx");

        // Choose the default worksheet in the workbook
        WorkSheet worksheet = workbook.DefaultWorkSheet;

        // Set formulas for various cells
        worksheet["A1"].Formula = "SUM(B8:C12)"; // Sum cells B8 to C12
        worksheet["B8"].Formula = "=C9/C11"; // Divide value in C9 by value in C11
        worksheet["G30"].Formula = "MAX(C3:C7)"; // Find the maximum value from cells C3 to C7

        // Force recalculating all formulas in all sheets
        workbook.EvaluateAll();

        // Retrieve calculated value from a cell
        string formulaValue = worksheet["G30"].Value.ToString(); // e.g., 52

        // Retrieve the formula as a string from a cell
        string formulaString = worksheet["G30"].Formula; // e.g., "MAX(C3:C7)"

        // Save changes with updated formulas and calculated values
        workbook.Save();
    }
}
Imports IronXL

Public Class ExcelExample
	Public Shared Sub Main()
		' Load an existing Excel workbook
		Dim workbook As WorkBook = WorkBook.Load("test.xlsx")

		' Choose the default worksheet in the workbook
		Dim worksheet As WorkSheet = workbook.DefaultWorkSheet

		' Set formulas for various cells
		worksheet("A1").Formula = "SUM(B8:C12)" ' Sum cells B8 to C12
		worksheet("B8").Formula = "=C9/C11" ' Divide value in C9 by value in C11
		worksheet("G30").Formula = "MAX(C3:C7)" ' Find the maximum value from cells C3 to C7

		' Force recalculating all formulas in all sheets
		workbook.EvaluateAll()

		' Retrieve calculated value from a cell
		Dim formulaValue As String = worksheet("G30").Value.ToString() ' e.g., 52

		' Retrieve the formula as a string from a cell
		Dim formulaString As String = worksheet("G30").Formula ' e.g., "MAX(C3:C7)"

		' Save changes with updated formulas and calculated values
		workbook.Save()
	End Sub
End Class
$vbLabelText   $csharpLabel

IronXL helps developers to rely on simple yet high-performance code with accuracy and efficiency, which helps reduce the risk of error and makes it easier to manipulate Excel files programmatically.

You can download the IronXL software product and try it for free.

Questions Fréquemment Posées

Comment puis-je convertir un tableau en plage dans Excel ?

Pour convertir un tableau en plage dans Excel, accédez à l'onglet Conception de tableau sous Outils de tableau et sélectionnez Convertir en plage. Alternativement, vous pouvez cliquer à droite dans le tableau, choisir Tableau, puis Convertir en plage. Cela supprimera les références structurées et la mise en forme du tableau tout en conservant les données.

Quels sont les avantages d'utiliser des tableaux dans Excel ?

Les tableaux Excel offrent des fonctionnalités telles que le filtrage automatique, les options de tri, l'expansion automatique, les colonnes calculées et les styles de tableau, qui aident à analyser et gérer efficacement les données.

Comment puis-je créer un tableau dans Excel en utilisant les raccourcis clavier ?

Vous pouvez créer un tableau dans Excel en sélectionnant une seule cellule dans votre jeu de données et en appuyant sur Ctrl + T. Cela ouvrira la boîte de dialogue Créer un tableau, vous permettant de formater vos données en tant que tableau.

Comment IronXL aide-t-il à manipuler les fichiers Excel par programmation ?

IronXL, une bibliothèque .NET, permet aux développeurs de lire, éditer et manipuler efficacement des documents Excel en C# sans besoin de Microsoft Excel. Il offre des fonctionnalités telles que l'ajout de lignes, l'application de fonctions et le style des cellules.

IronXL peut-il gérer divers formats de fichiers Excel ?

Oui, IronXL peut charger, lire et éditer des données à partir des fichiers XLS, XLSX, CSV et TSV. Il permet également d'enregistrer et d'exporter dans ces formats ainsi que JSON.

Est-il possible de travailler avec des fichiers Excel dans des environnements cloud en utilisant IronXL ?

Oui, IronXL prend en charge la manipulation de fichiers Excel sur des plateformes cloud comme Azure et AWS. Il fonctionne également dans des environnements tels qu'Android, Xamarin, Linux, macOS, Docker et MAUI.

Quelles options de style IronXL propose-t-il pour les fichiers Excel ?

IronXL offre diverses options de style, y compris le type et la taille de police, les styles de cellules, les alignements, et les couleurs d'arrière-plan, permettant une personnalisation des feuilles de calcul Excel.

Pourquoi convertir un tableau en plage dans Excel ?

Convertir un tableau en plage peut être utile si vous souhaitez simplifier le processus de gestion des données en supprimant les fonctionnalités du tableau comme le filtrage automatique, le tri et la mise en forme tout en conservant les données et les formules sous-jacentes.

Comment IronXL améliore-t-il la manipulation des fichiers Excel ?

IronXL améliore la manipulation des fichiers Excel en fournissant un moyen simple et efficace d'interagir avec les documents Excel par programmation, offrant des fonctionnalités telles que le support des formules, le chargement de données, l'exportation et des options de style étendues.

Jordi Bardia
Ingénieur logiciel
Jordi est le plus compétent en Python, C# et C++, et lorsqu'il ne met pas à profit ses compétences chez Iron Software, il programme des jeux. Partageant les responsabilités des tests de produit, du développement de produit et de la recherche, Jordi apporte une immense valeur à l'amé...
Lire la suite