Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The functionality that I am going for is this:

  1. Click on a menu option
  2. Interactive box comes up with 6 textboxes that correspond with a label each
  3. In two of those boxes, at most three, a number is inputted
  4. Corresponding to an algorithm those numbers will change the values in the current active cell range if the value in the cell (a letter) is equal to the label of any of the earlier textbox inputted values, the empty cells get left empty, others that have no correspondence will be changed to 0.
  5. Click OK, the active selected cell range changes accordingly.

I want this functionality to be embedded into the Spreadsheet. I've already started, but since I haven't done anything with GAS I've stumbled upon a few problems and need a solution from someone that knows how to use GAS. I don't know if this functionality is possible the way I envisioned it.

function calculateScores() {
 var sheet = SpreadsheetApp.getActiveSheet();
 var range = sheet.getActiveRange();
 var values = range.getValues();
 for (var i = 0; i <= values.length - 1; i++) {
  var row = values[i];

function onOpen() {
 var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
 var entries = [{
 name : "Calculate Scores",
 functionName : "calculateScores"
 spreadsheet.addMenu("Calculate Scores", entries);

This creates the menu item and just logs the selected range. Moving forward, how do I solve the problem with the rest of the interface and functionality?

share|improve this question
Have a look at this simple dialogue form: webapps.stackexchange.com/a/35776/29140 – Jacob Jan Tuinstra Apr 23 '14 at 18:17
What is it more specifically you need help with? Is it the dialog box? – Punchlinern Apr 23 '14 at 19:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.