WorksheetCollection class

WorksheetCollection class

Encapsulates a collection of Worksheet objects.

The WorksheetCollection type exposes the following members:

Properties

PropertyDescription
web_extension_task_panesGets the list of task panes.
web_extensionsGets the list of task panes.
threaded_comment_authorsGets the list of threaded comment authors.
is_refresh_all_connectionsIndicates whether refresh all connections on opening file in MS Excel.
namesGets the collection of all the Name objects in the spreadsheet.
active_sheet_nameRepresents the name of active worksheet when the spreadsheet is opened.
active_sheet_indexRepresents the index of active worksheet when the spreadsheet is opened.
dxfsGets the master differential formatting records.
xml_mapsGets and sets the XML maps in the workbook.
built_in_document_propertiesReturns a DocumentProperty collection that represents all the built-in document properties of the spreadsheet.
custom_document_propertiesReturns a DocumentProperty collection that represents all the custom document properties of the spreadsheet.
ole_sizeGets and Sets displayed size when Workbook file is used as an Ole object.
external_linksRepresents external links in a workbook.
table_stylesGets WorksheetCollection.table_styles object.
revision_logsRepresents revision logs.
capacityGets or sets the number of elements that the array list can contain.

Methods

MethodDescription
getAdd API for Python Via .Net.since this[int index] is unsupported
getAdd API for Python Via .Net.since this[string sheetName] is unsupported
addAdds a worksheet to the collection.
addAdds a worksheet to the collection.
addAdds a worksheet to the collection.
register_add_in_functionAdds addin function into the workbook
register_add_in_functionAdds addin function into the workbook
add_copyAdds a worksheet to the collection and copies data from an existed worksheet.
add_copyAdds a worksheet to the collection and copies data from an existed worksheet.
add_copyCopy a group of worksheets.
get_range_by_nameGets Range object by pre-defined name.
get_range_by_nameGets Range by pre-defined name or table’s name
refresh_pivot_tablesRefreshes all the PivotTables in the Excel file.
refresh_pivot_tablesRefreshes all the PivotTables in the Excel file.
copy_toCopies the entire array list to a compatible one-dimensional array list, starting at the beginning of the target array list.
copy_toCopies a range of elements from the array list to a compatible one-dimensional array list, starting at the specified index of the target array list.
index_ofSearches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the array list that extends from the specified index to the last element.
index_ofSearches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the array list that starts at the specified index and contains the specified number of elements.
last_index_ofSearches for the specified object and returns the zero-based index of the last occurrence within the entire array list.
last_index_ofSearches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the array list that extends from the first element to the specified index.
last_index_ofSearches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the array list that contains the specified number of elements and ends at the specified index.
create_rangeCreates a Range object from an address of the range.
create_union_rangeCreates a Range object from an address of the range.
get_sheet_by_code_nameGets the worksheet by the code name.
sort_namesSorts the defined names.
swap_sheetSwaps the two sheets.
remove_by_nameRemove a sheet by sheet name.(CELLSPYTHONNET-192)
remove_by_indexRemove a sheet by sheet index
remove_atRemoves the element at a specified name.
get_named_rangesGets all pre-defined named ranges in the spreadsheet.
get_named_ranges_and_tablesGets all pre-defined named ranges in the spreadsheet.
set_ole_sizeSets displayed size when Workbook file is used as an Ole object.
clear_pivottablesClears pivot tables from the spreadsheet.
refresh_allRefresh all pivot tables and charts with pivot source.
binary_searchSearches the entire sorted array list for an element using the default comparer and returns the zero-based index of the element.

Example

from aspose.cells import Workbook

workbook = Workbook()
sheets = workbook.worksheets
# Add a worksheet
sheets.add()
# Change the name of a worksheet
sheets[0].name = "First Sheet"
# Set the active sheet to the second worksheet
sheets.active_sheet_index = 1

See Also