37
rated 0 times
[
38]
[
1]
/ answers: 1 / hits: 48823
/ 10 Years ago, wed, april 2, 2014, 12:00:00
I'm currently working on a script that will import the holiday and appointments calender to make it public, however there are some things on this holiday calendar that need removing so after the sheets are imported i'm scanning the values of each cell to remove the cells that contain stuff others shouldnt be able to see
var code = ss.getSheetByName(mysheet).getRange(k,j).getValue();
if (code != HD || code != H || code != BH || code !== ) {
ss.getSheetByName(mysheet).getRange(k,j).setValue();
}
This is the code that is used for getting the value of the cell and checking it, it looks for cells that are not blank or do not contain any off the allowed codes however for some reason it keeps picking up every blank cell, why is this?
Also is there any over way to make this code run more faster and effectively?
function scanSheet(mysheet,lastdatecol){
var lastrw= ss.getSheetByName(mysheet).getDataRange().getLastRow();
for (var k=3; k<=lastrw; k++){
var surname = holidayNamesObjects[k-3].surname;
var forename = holidayNamesObjects[k-3].firstName;
ss.getSheetByName(mysheet).getRange(k, 1).setValue(forename + + surname)
for (var j = 3; j < lastdatecol+1; j++){
var code = ss.getSheetByName(mysheet).getRange(k,j).getValue();
if (code != HD || code != H || code != BH || code !== ) {
ss.getSheetByName(mysheet).getRange(k,j).setValue();
}
}
}
}
More From » google-apps-script