0

Ok first time using google sheets. I have made a data validation list .I know I can do Not in list in excel but how do I do it in google sheets. So the user can enter data and it gets saved back to list. I have my data validation set up so it accepts other text but I dont know how to add it to the list.

1
  • Can you provide a copy of the spreadsheet you are working on (free of sensitive information), clearly indicating the desired outcome? Commented Mar 24, 2021 at 10:34

1 Answer 1

0

Although a Google Script can achieve what you're looking for where a user can simply have an option to enter a string of text on an alert box and it gets added to data validation list, a more straight forward approach is to use your source of data in data validation as "Range" of a section of your main Sheet or have it located on a different sheet. That way, any items listed on your range will be part of the Data Validation and users can simply add more items to the empty cells defined on your data validation range.

enter image description here

Quick Edit You can also try a simple script below that prompts user to input something they want to add to the dropdown list. You may refer to this documentation for the specifics.

function Additem() {
  var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Database"); //Defined the sheet where to make edits
  var lastrow = ss.getLastRow(); //Defines the last item on row with content
  var targetcell = ss.getRange(lastrow+1,1); //Select whatever the next available blank row on column A to add entry to data validation

  //UI Prompt for Adding Values
    var sui = SpreadsheetApp.getUi();
    var theprompt = sui.prompt("Add item to selection", sui.ButtonSet.OK_CANCEL);
    var usersinput = theprompt.getResponseText();
    Logger.log(usersinput)

  //Conditional action for the UI
    if (theprompt.getSelectedButton() == sui.Button.OK) {
        targetcell.setValue(usersinput);
        } else SpreadsheetApp.getActiveSpreadsheet().toast("Adding to drop down list cancelled","Notification");
}

This assumes that your sheet where you store your data is named Database (You can always change that part on the code. And what this does is add whatever was input on the prompt to the next empty cell on Column A1.

See samples below:

enter image description here

After entering any value on the prompt:

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

I have done that but I am trying to avoid the user going into the sheet that the data range is stored in
I've edited my answer to include a simple script you can use for this.
Thank you but how do I tye it in with my list. So the data Validation list is in "Invoices" sheet and in cell B6 only and it will get saved to "Customers" sheet in the next empty cell after A!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.