javascript - google apps script doGet -


i'm having problems code. google deprecated several pieces working. when making new sheet , trying use old code, errors , can't find way make changes documentation @ google.

function doget(e) {      //this not working?      if (typeof e.parameter.id  == 'undefined'){              return no_id(e) // url doesn't have ?id=345 on end!     }      var id = parseint( e.parameter.id ) // id of row in spreadsheet.      //script properties changed , think now: propertyservice.getscriptproperties() // data spreadsheet , row matches id      var this_spreadsheet_id = scriptproperties.getproperty('this_spreadsheet_id')     var ss = spreadsheetapp.openbyid(this_spreadsheet_id)     var sheet = ss.getsheetbyname("sheet1")     var range = sheet.getdatarange()     var last_row = range.getlastrow()     var last_column = range.getlastcolumn()      for(i = 2; <= last_row ; i++){          var this_row = sheet.getrange(i,1 , 1, last_column)         var values = this_row.getvalues()[0]         var row_id = parseint( values[0] )          //row id == id not working either          if ( row_id == id){                     var title = values[5]             var details = values[8]             var status_txt = values[7]              logger.log( "status: " + status )              var image_url = values[4]         }     } } 

any idea's great!

thanks,

"referenceerror: "id" not defined. (line 23, file "code")"

you have return in if statement before id defined. if not being defined if statement being triggered. move variable definitions top.

var id = parseint( e.parameter.id ) // id of row in spreadsheet.  //script properties changed , think now: propertyservice.getscriptproperties() // data spreadsheet , row matches id  var this_spreadsheet_id = scriptproperties.getproperty('this_spreadsheet_id') var ss = spreadsheetapp.openbyid(this_spreadsheet_id) var sheet = ss.getsheetbyname("sheet1") var range = sheet.getdatarange() var last_row = range.getlastrow() var last_column = range.getlastcolumn()  if (typeof e.parameter.id  == 'undefined'){          return no_id(e) // url doesn't have ?id=345 on end! } 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -