Example: addTo method

This example shows how to add a sheet before the active sheet.

try {
  Application application = Application.getInstance();
  Spreadsheets spreadsheets = application.getSpreadsheets();
  Spreadsheet spreadsheet = spreadsheets.openSpreadsheet("D:\\test.ods",true);
  Sheets sheets = spreadsheet.getSheets();
  sheets.addTo(spreadsheet.getActiveSheet(), 1, true);
} catch(Exception e) {
  e.printStackTrace();
}

Related information

addTo method