Google Apps Script: how to make suggest box library to work?
        Posted  
        
            by 
                Pythonista's Apprentice
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Pythonista's Apprentice
        
        
        
        Published on 2013-11-09T03:51:07Z
        Indexed on 
            2013/11/09
            3:53 UTC
        
        
        Read the original article
        Hit count: 236
        
I'm trying to add an autocomplete feature in my Google Spreadsheet using this Google Apps Script suggest box library from Romain Vialard and James Ferreira's book:
function doGet() {
  // Get a list of all my Contacts
  var contacts = ContactsApp.getContacts();
  var list = [];
  for(var i = 0; i < contacts.length; i++){
    var emails = contacts[i].getEmails();
    if(emails[0] != undefined){
      list.push(emails[0].getAddress());
    }
  }
  var app = UiApp.createApplication();
  var suggestBox = SuggestBoxCreator.createSuggestBox(app, 'contactPicker', 200, list);
  app.add(suggestBox);
  return app;
}
function onEdit() {
  var s = SpreadsheetApp.getActiveSheet();
  if( s.getName() == "my_sheet_name" ) { //checks that we're on the correct sheet
    var r = s.getActiveCell();
    if( r.getColumn() == 1) {
      doGet();
    }
  }
}
But when I start editing the column 1 of "my_sheet_name" nothing hapens (if I replace doGet() for other function, this other function runs Ok). I've already installed the Suggest Box library. So, why the doGet() function doesn't work?
© Stack Overflow or respective owner