Validating a Cell having extra blank spaces
I am using data validation for a "Day of the week" column using items from a list. Here is my list:
This can be done with the help of the following script:
I have written this following script for only Cell H2 and only for "Sunday".
I have also put Data validation on Cell H2 for it should be only from list:
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("mainsheet"); // your sheet name
var range = sheet.getDataRange();
var CellValue = range.offset(1, 7, 1, 1).getValue(); // Cell H2
range.offset(1, 7, 1, 1).setValue("Sunday");
The above script will execute on every time when a user will edit this spreadsheet.
If user inputs "Sunday " it will change it to "Sunday".
I hope this script helps you in validating your data.
I hope the above solution will help you, and if you need more help then please do comment below on this blog itself I will try to help you out.
If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: http://igoogledrive.blogspot.com/2012/09/donate.html