title: Input name and check for existence of spreadsheet
body: <p>I am trying to create a spreadsheet if it does not exist. Name of the spreadsheet should be a user input how would I do this?</p>
  
  <pre><code>function createSpreadsheet() {
      var file = DriveApp.getFilesByName(NewSpreadsheet);
  
      if (file != null) {
          var NewSpreadsheet = SpreadsheetApp.create("TestGSS");
          var DataSheet = NewSpreadsheet.getSheetByName("Data");
          // Get the URL of the document.
          var url = NewSpreadsheet.getUrl();
  
          // Get the email address of the active user - that's you.
          var email = Session.getActiveUser().getEmail();
      }
  
      Logger.log(file);
  
      if (DataSheet != null) {
          NewSpreadsheet.deleteSheet(DataSheet);
      }
  
      DataSheet = NewSpreadsheet.insertSheet();
      DataSheet.setName("Data");
  
      Logger.log(NewSpreadsheet.getUrl());
      Logger.log(Session.getActiveUser().getEmail());
  
  }
  </code></pre>
  
  <p>I tried doing the below for user input and check for file existence but no luck.</p>
  
  <pre><code>function spreadsheetName() {
      var name = Browser.inputBox('Sheet name', 'Enter spreadsheet name', Browser.Buttons.OK_CANCEL);
  }
  </code></pre>
  
  <p>this keeps giving me cannot call Browser.inputBox() from this context</p>
  
  <pre><code>function spreadsheetName() {
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var sheet = ss.getSheets()[0];
  
      Logger.log(sheet.getSheetName());
  }
  </code></pre>
  
  <p>this gives cannot call getSheets method.</p>