JavaScript - Google Apps Script tutorial - Function Return Date & Time Stamp

preview_player
Показать описание


First video, let me know what you think and what I should record for next time!

Рекомендации по теме
Комментарии
Автор

It would be really great if you can kindly explain the way to change a date format in app script which is extracted from a google sheet cell

kaushalya
Автор

I want to run two different scripts in the same google sheet,

The first one is that when I say "Yes" then it moves the whole row to the other targeted sheet.

function onEdit(event) {
// assumes source data in sheet named Needed
// target sheet of move to named Acquired
// test column with yes/no is col 4 or D
var ss =
var s =
var r =

if(s.getName() == "Sheet1" && r.getColumn() == 44 && r.getValue() == "Yes") {
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Me");
var target = + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);
}


Meanwhile, I want to run the same script in the same google sheet, just changed the followings,

When the sheet moved to the other sheet by choosing "Yes", but I want to get back the same row to the same sheet by saying "No". The script will be as below


}
function onEdit(event) {
// assumes source data in sheet named Needed
// target sheet of move to named Acquired
// test column with yes/no is col 4 or D
var ss =
var s =
var r =

if(s.getName() == "Me" && r.getColumn() == 44 && r.getValue() == "No") {
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Sheet1");
var target = + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);
}
}


But, I can't run both of them at the same time. Your great support is greatly appreciated in this regard.

Please help me, thanks in advance.

findthetruth
Автор

I am currently struggling with another issue in Google sheet online in which I am trying to create/ apply protection range only to those raws that have a specific words in their drop down, so in a nutshell, I want to make automatic protection based on conditional. For instance, I have a data entry in which the team leaders fill it, and they have a column to approve them if they choose "yes approved" then automatically lock these raws for them not let other users including themselves be able to edit them, except me (The owner), and if it was not then leaving it as it is. Thanks in advance. I have searched a lot but didn't find anything like this.
For instance,


1- Raw In the drop-down if they choose Yes (Then automatically apply protection to the whole row )
2- Row in the dropdown if they choose No (Then it remains as it is no form of protection will be applied )

findthetruth
Автор

How can I format date from a google sheet to import to an html table using javascript. Whenever I try it it give mes additional info on time zone and when all I want is ww-dd-yyyy format? Thanks in advance

abelinogomez