Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

So here is what I am trying to do:

Have a Google site that has an embedded editable Google spreadsheet on that allows end users (if they have been given permission) to edit the spreadsheet.

Here is the purpose, I am trying to create a tasks list application that allows authorised users to view a list of currently available tasks (from Google spreadsheet) and then assign themselves a task (which will be one of the columns in the spreadsheet "assigned". Is there a way to have that column (assigned) a drop down box of the current user signed in? I.e. so when user 1 logs in to the site, any task they want to assign themselves will have a drop down option of blank or their name. The same goes for all other users.

Is that possible?

share|improve this question

2 Answers 2

The following piece of code does the trick:

function onOpen() {
  // get active spreadsheet
  var ss = SpreadsheetApp.getActiveSpreadsheet();

  // create menu
  var menu = [
    {name: "Add active user", functionName: "addUser"}
  ];

  // add to menu
  ss.addMenu("Add user", menu);
}

function addUser() {
  // get active spreadsheet
  var ss = SpreadsheetApp.getActiveSpreadsheet();

  // get first sheet
  var sheet = ss.getSheets()[0];

  // get data
  var user = Session.getActiveUser().getUserLoginId()

  // get active/selected row
  var activeRow = ss.getActiveRange().getRowIndex();

  // set user to cell
  sheet.getRange("B"+activeRow).setValue(user);  
}

It adds a menu item to the existing menu upon file opening. The selection lets the user decide whether to assign her/his name (e-mail). I've tried it, using my own two accounts in two different browsers.

See example file I've created: add active user

share|improve this answer

When you link the spreadsheet, it comes up with a link at the bottom to open the document. Or when you upload it, you can upload it as a list which is editable.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.