Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8170055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:03:07+00:00 2026-06-06T21:03:07+00:00

first time deploying a UI web app in GAS. Getting a Cannot call method

  • 0

first time deploying a UI web app in GAS. Getting a “Cannot call method “getSheets” of null” TypeError after trying to view the deployed script url:

https://script.google.com/macros/s/AKfycbzuQNbkTeBpRPz75Q4dRiVLfEYtuLiuBKnWeA5CbD0/dev

Here’s the spreadsheet:

https://docs.google.com/spreadsheet/ccc?key=0AnJTymuE8awLdHZ6QzhNVXpjeFphM3pMV1cxU0daZ2c

Script code:

// https://developers.google.com/apps-script/class_listbox - How to create listBox
function doGet() {
   //var ss = SpreadsheetApp.openById("0AnJTymuE8awLdHZ6QzhNVXpjeFphM3pMV1cxU0daZ2c");
   var ss = SpreadsheetApp.getActiveSpreadsheet();
   var sheet = ss.getSheets()[1];  
   var app = UiApp.createApplication().setTitle('App to show how ListBox data can update');
   var panel = app.createVerticalPanel();
   var lb = app.createListBox(true).setId('myLBid').setName('myLBname');

   // how many items to show
   lb.setVisibleItemCount(10);

   // get sorted names
   var rows = sheet.getDataRange();
   var numRows = rows.getNumRows();
   var values = rows.getValues();

   for (var i = 0; i <= numRows - 1; i++) {
     var row = values[i];
     lb.addItem(row);
   }

   panel.add(lb);
   var button = app.createButton('Submit');
   var handler = app.createServerClickHandler('respondToSubmit').addCallbackElement(panel);
   button.addClickHandler(handler);
   panel.add(button);
   app.add(panel);
   ss.show(app);
 }

// http://youtu.be/5VmEPo6Rkq4 - How to have sumbit write data to ss
function respondToSubmit(e) {
   var app = SpreadsheetApp.getActiveSpreadsheet();
   //reference widget name to capture what user selected
   var listBoxValue = e.parameter.myLBname;
   var ss = SpreadsheetApp.getActiveSpreadsheet();
   var sheet = ss.getSheets()[2];
   var lastRow = sheet.getLastRow()+1;
   var lastCell = sheet.getRange("A"+lastRow);
   lastCell.setValue(listBoxValue);
   return app.close();
}

/**
 * Adds a custom menu to the active spreadsheet, containing a single menu item
 * for invoking the readRows() function specified above.
 * The onOpen() function, when defined, is automatically invoked whenever the
 * spreadsheet is opened.
 * For more information on using the Spreadsheet API, see
 * https://developers.google.com/apps-script/service_spreadsheet
 */
function onOpen() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var entries = [{
    name : "Names",
    functionName : "doGet"
  }];
  sheet.addMenu("Script Menu", entries);
};

Works perfect when ran from the editor.

Would like to find out what I need to modify in the code for the web app to work. I’m expecting the UI to appear in the script url just like it does when ran inside the ss. Is that not what should happen?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:03:09+00:00Added an answer on June 6, 2026 at 9:03 pm

    EDIT : Ooops, sorry, I didn’t notice some other errors, please have a look at the documentation about differences between webApps and spreadsheet UIs and read my answer after that .

    Why did you commented this line ?

    SpreadsheetApp.openById("0AnJTymuE8awLdHZ6QzhNVXpjeFphM3pMV1cxU0daZ2c");

    when running as a webapp you should always open spreadsheets by ID since there is no active spreadsheet (view from the spreadsheet no user has open the spreadsheet, only the script has…)

    Also : what do you mean exactly by ” I’m expecting the UI to appear in the script url “ ?

    Your Ui will appear as a standalone app when you go to the url that will be created when you deploy it.(you’ll have to save a version of it too but it’s quite well explained when doing it)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting an error while deploying code for the first time. I used
On my server when deploying the app for the first time, I ran rake
I'm deploying a site for the first time and after the initial upload of
I'm deploying a Python app on Windows for the first time (Apache & mod_wsgi/Flask/Sqlalchemy).
I am using Jetty for the first time to deploy a GWT web app
I'm deploying a new Rails app to Heroku. This is the first time I've
First time I am using the persist() method in a project. With JPA I
First time working with JSON in Rails and trying to figure out something which
first time posting here so be gentle :) On my web pages I have
This is my first time trying to set up capistrano to deploy a rails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.