Reading and Writing Query Table of Worksheet

Reading and Writing Query Table of Worksheet

The following sample code reads the first QueryTable of the first worksheet and then prints both QueryTable properties. It then sets QueryTable.PreserveFormatting to true.

You can download the source Excel file used in this code and the output Excel file generated by the code from the following links.

Console Output

Here is the console output from the above sample code:

Adjust Column Width: True

Preserve Formatting: False

Retrieve Query Table Result Range

Aspose.Cells provides an option to read the address, i.e., the result range of cells for a query table. The following code demonstrates this feature by reading the address of the result range for a query table. The sample file can be downloaded here.