0

Has anyone ever come across this error before from running UI App published as web app?:

Error encountered: Cannot find method (class)getRange((class),number,number,number).

I googled the phrase and came up with zero search results.

The web app loads fine from the doGet(), and the error comes up after a small server handler operates. Thing is the handler runs through everything fine (My "processing..." label at the end of handler function switches visibility off) and the spreadsheet I'm calling is updated no problem. I checked my code, and all my getRanges are properly formatted with sheet.getRange(row,col,num,num).

GAS acted weird once yesterday with an odd error it seems when they updated the Ctrl-F find ability yesterday, but that was fixed with a simple refresh of that page. I have refreshed after today's new error but it still comes up after running the handler. Anyone else running into this or have a solution?


Well, I've copy pasted the code into another script, and made a copy of the spreadsheet I am calling, but I still get the error. Here is the "offending" code according to google's error trigger:

function addNewCo(e) {
  var app=UiApp.getActiveApplication();
  var newCoName=e.parameter.newCoName;
  coSheet.appendRow([newCoName]);
  coSheet.sort(1,true);
  var coSheetValues=coSheet.getRange(2,1,coSheet.getLastRow()-1,coSheet.getLastColumn()).getValues();
  app.getElementById('coNameLB').clear().addItem(newCoName).addItem('').addItem('Select Company ---');
  for (i=0;i<coSheetValues.length;i++){ app.getElementById('coNameLB').addItem(coSheetValues[i][coSheetColNamesArray.indexOf('Company Name')]); }
  app.getElementById('popupPanel').setVisible(false);
  app.getElementById('GoBtn').setStyleAttribute('background','#2a9c3b').setEnabled(true);
  app.getElementById('processingLbl').setVisible(false);
  return app;
}

As I said above, the handler completes it's function, so why would this error be popping up at me?


This is getting really nuts. I removed any reference to the sheet after the append and sort, in other words I took out the getRange in the handler function altogether, but the error still keeps popping up!

function addNewCo(e) {
  var app=UiApp.getActiveApplication();
  var newCoName=e.parameter.newCoName;
  coSheet.appendRow([newCoName]);
  coSheet.sort(1,true);
  app.getElementById('coNameLB').clear().addItem(newCoName).addItem('').addItem('Select Company ---');
  app.getElementById('popupPanel').setVisible(false);
  app.getElementById('GoBtn').setStyleAttribute('background','#2a9c3b').setEnabled(true);
  app.getElementById('processingLbl').setVisible(false);
  return app;
}

I am not even calling a getRange, so how can the error be popping up still?


Unbelievable. Now I took out any mention of the spreadsheet from the handler, and I STILL get the error. What the heck Google?!? The doGet() function loads fine, the error only comes up using the handler - even when there is no mention of the spreadsheet - what in the world?!?:

function addNewCo(e) {
  var app=UiApp.getActiveApplication();
  var newCoName=e.parameter.newCoName;
  app.getElementById('coNameLB').clear().addItem(newCoName).addItem('').addItem('Select Company ---');
  app.getElementById('popupPanel').setVisible(false);
  app.getElementById('GoBtn').setStyleAttribute('background','#2a9c3b').setEnabled(true);
  app.getElementById('processingLbl').setVisible(false);
  return app;
}

I have stripped the handler function to just closing the popup and I still get the error.

function addNewCo(e) {
  var app=UiApp.getActiveApplication();
  app.getElementById('popupPanel').setVisible(false);
  return app;
}

Anyone from Google on here care to help?

4

1 に答える 1

3

修正しました。フィールドの配列の一部として、本来あるべきではない他のフォーカスハンドラーを取得するテキストボックスがありました。不可解なエラーとその意味のリストがどこかにあり、行番号がエラーメッセージダイアログボックスのポップアップに表示され、問題の場所を示していれば、Google は非常に役に立ちます。コード。Google Apps スクリプトからのエラー メッセージを Google 検索しても結果が返されないのはばかげています。2時間無駄。

于 2013-02-01T22:25:38.397 に答える