Sorgu Tablosu Veri Kaynağı ile Tablo Okuma ve Yazma
Contents
[
Hide
]
Sorgu Tablosu Veri Kaynağı ile Tablo Okuma ve Yazma
Aspose.Cells for Python via Java ile Datasource olarak QueryTable olan bir tabloyu okuyabilir ve yazabilirsiniz. Bu özellik için destek, XLS dosyaları için de mevcuttur. Aşağıdaki kod parçacığı, önce tabloyu okuyarak ve ardından toplamlar satırını eklemek için değiştirerek böyle bir tablonun okunmasını ve yazılmasını gösterir.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source_directory = "Examples/SampleFiles/SourceDirectory/" | |
output_directory = "Examples/SampleFiles/OutputDirectory/" | |
# Load workbook object | |
workbook = Workbook(source_directory + "SampleTableWithQueryTable.xls") | |
worksheet = workbook.getWorksheets().get(0) | |
# Access first list object or table | |
listObj = worksheet.getListObjects().get(0) | |
# Check the data source type if it is query table | |
if (listObj.getDataSourceType() == TableDataSourceType.QUERY_TABLE): | |
listObj.setShowTotals(True) | |
# Save the excel file. | |
workbook.save(output_directory + "SampleTableWithQueryTable_out.xls") |
Kaynak ve çıktı excel dosyaları referans için eklenmiştir.