WbkDocument.removeSheet

Syntax

removeSheet (value);

Parameters

value. Sets value for the key.

Description

The removeSheet method removes sheet by its key or ID.

Example

To execute the example, create a service for working with time series, get a workbook instance from the time series database (see WbkDocument.ActiveSheetKey) and add the following code in the handler that processes document opening:

	// Create a button class instance
	var btnInsertSerie = new PP.Ui.Button({
		ParentNode: "test", //DOM parent node
		Content: "RemoveSheet", //text
		Click: PP.Delegate(function(sender, args){ //click handler
			// Get sheet object by key or Id
			var sheet = wbkDocument.getSheet(sheetKey);
			console.log("sheet object by key or Id");
			console.log(sheet);
			// Remove sheet by key or Id
			console.log("Remove sheet by key or Id");
			wbkDocument.removeSheet(sheetKey);
			// Get sheet object by key or Id again
			// to check if the sheet is removed
			var sheet = wbkDocument.getSheet(sheetKey);
			console.log("sheet object by key or Id");
			console.log(sheet);
		}, this)
	});

After executing the example clicking the RemoveSheet button removes current sheet from the workbook. The browser console displays information on the sheet deletion process:

number of the current sheet

857804

sheet object by key or ID

PP.TS.Workbook {_WbkMetadata: Object, _Events: Object, ChangedSeries: PP.Delegate, WorkbookMdLoaded: PP.Delegate, _SelectedSeries: Array[0]…}

Remove sheet by key or ID

sheet object by key or ID

null

See also:

WbkDocument