Example: activate method

This example activates the first sheet, and then activates the second sheet.

try {
  Application application = Application.getInstance();
  Spreadsheets spreadsheets = application.getSpreadsheets();
  Spreadsheet spreadsheet = spreadsheets.openSpreadsheet("D:\\test.ods", true);
  Sheets sheets = spreadsheet.getSheets();
  if(sheets.getCount()>2){
   	sheets.item(1).activate();
   	System.out.println("Active sheet(Item 1) : "+spreadsheet.getActiveSheet().getName());
   	sheets.item(2).activate();
   	System.out.println("Active sheet(Item 2) : "+spreadsheet.getActiveSheet().getName());
  }
} catch(Exception e) {
  e.printStackTrace();
}

Related information

activate method