How to add and remove sheets using a JavaScript macro in Calc?

As per @joshua4 's suggestion, I’m posting this question so they can submit their solution to it here.

You do this in the exact same ways as with any other language.
[Tutorial] Introduction into object inspection with MRI

To expand on what Villeroy is saying…

then search under the Office API reference field.

This will add a sheet as the second sheet:

//Mini-dmonstration of how to add a sheet
//	for Calc using LibreOffice implementation of Rhino

//Import the Uno runtime interfaces

//Import the Uno Calc interfaces

//Rhino seems to have these handled...

//Get sheets object
var polySheets = UnoRuntime.queryInterface(
	XSpreadsheetDocument, XSCRIPTCONTEXT.getDocument()
var xspreadsheetsSheets = UnoRuntime.queryInterface(XSpreadsheets, polySheets);

//Insert new sheet in position 2 (i.e. index 1)
xspreadsheetsSheets.insertNewByName("NewerSheet", 1); //Will throw if name is not unique