Example: closeSpreadsheets method

This example opens several spreadsheets and closes all of them without saving changes

try {
  Application application = Application.getInstance();
  Spreadsheets spreadsheets = application.getSpreadsheets();
  Spreadsheet spreadsheet1 = spreadsheets.openSpreadsheet("D:\\test.ods", true);
  Spreadsheet spreadsheet2 = spreadsheets.openSpreadsheet("D:\\test2.ods", true);
  Spreadsheet spreadsheet3 = spreadsheets.openSpreadsheet("D:\\test3.ods", true);
  spreadsheets.closeSpreadsheets(false);
} catch(Exception e) {
  e.printStackTrace();
}

Related information

closeSpreadsheets method