Delaying on Edit Function to Insert TimestampOnEdit-trigger combined with cell-functionsRetrieve row from a table (with a specific value) and insert specific row to a new sheetIs it possible for an on Edit function to determine whether a cell's value contains an uppercase letter or background colour changing of a cellAdd a timestamp to one column when other columns changedCount number of rows in sheet then subtract on a Google spreadsheet with Google Apps ScriptGoogle Script Timestamps onChange?How do I timestamp base on an index formula cell with onEdit script?How to get filterByText() to filter out blank cellsTrying to convert Google Sheets moveTo script to copyTo scriptInsert timestamp based on specific criteria

Youtube not blocked by iptables

Why does this image of Jupiter look so strange?

1, 2, 4, 8, 16, ... 33?

Global Frame of Reference in General Relativity

How can an attacker use robots.txt?

Does every piano need tuning every year?

A food item only made possible by time-freezing storage?

Fuel sender works when outside of tank, but not when in tank

Why did the Soviet Union not "grant" Inner Mongolia to Mongolia after World War Two?

Does wetting a beer glass change the foam characteristics?

Why is a road bike faster than a city bike with the same effort? & how much faster it can be?

Why is 6. Nge2 better, and 7. d5 a nessecary push in this game?

What secular civic space would pioneers build for small frontier towns?

Designing a time thief proof safe

Do we know the situation in Britain before Sealion (summer 1940)?

Is the mass of paint relevant in rocket design?

Lost Update Understanding

Why, even after his imprisonment, people keep calling Hannibal Lecter "Doctor"?

Is there a way to hide HTML source code yet keeping it effective?

List of 1000 most common words across all languages

I nicked the tip of the taper on a bottom bracket spindle. Is it still safe?

My manager quit. Should I agree to defer wage increase to accommodate budget concerns?

My Project Manager does not accept carry-over in Scrum, Is that normal?

Labview vs Matlab??Which one better for image processing?



Delaying on Edit Function to Insert Timestamp


OnEdit-trigger combined with cell-functionsRetrieve row from a table (with a specific value) and insert specific row to a new sheetIs it possible for an on Edit function to determine whether a cell's value contains an uppercase letter or background colour changing of a cellAdd a timestamp to one column when other columns changedCount number of rows in sheet then subtract on a Google spreadsheet with Google Apps ScriptGoogle Script Timestamps onChange?How do I timestamp base on an index formula cell with onEdit script?How to get filterByText() to filter out blank cellsTrying to convert Google Sheets moveTo script to copyTo scriptInsert timestamp based on specific criteria






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-1















When the status in Column A is changed to "Completed" the row is being moved to another tab called "Archive". I have tried to edit my existing script to insert a timestamp in Column C when the status is changed to "Completed", however the script runs too fast and doesn't insert the timestamp.



I have tried to insert a delay function after the getRange function, but it did not input a date at all. I have also tried to create a trigger delay and did not have any success.



function onEdit(event) 

var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();


if(s.getName() == "Terminations" && r.getColumn() == 1 && r.getValue() == "Completed")
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Processed Terminations");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);




In Column C, I would like the a timestamp to be inserted when a row is marked as "Complete"










share|improve this question


























  • This code doesn't even try to write to the spreadsheet - it just moves a row. stackoverflow.com/help/mcve && stackoverflow.com/help/how-to-ask

    – tehhowch
    Mar 28 at 15:56

















-1















When the status in Column A is changed to "Completed" the row is being moved to another tab called "Archive". I have tried to edit my existing script to insert a timestamp in Column C when the status is changed to "Completed", however the script runs too fast and doesn't insert the timestamp.



I have tried to insert a delay function after the getRange function, but it did not input a date at all. I have also tried to create a trigger delay and did not have any success.



function onEdit(event) 

var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();


if(s.getName() == "Terminations" && r.getColumn() == 1 && r.getValue() == "Completed")
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Processed Terminations");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);




In Column C, I would like the a timestamp to be inserted when a row is marked as "Complete"










share|improve this question


























  • This code doesn't even try to write to the spreadsheet - it just moves a row. stackoverflow.com/help/mcve && stackoverflow.com/help/how-to-ask

    – tehhowch
    Mar 28 at 15:56













-1












-1








-1


1






When the status in Column A is changed to "Completed" the row is being moved to another tab called "Archive". I have tried to edit my existing script to insert a timestamp in Column C when the status is changed to "Completed", however the script runs too fast and doesn't insert the timestamp.



I have tried to insert a delay function after the getRange function, but it did not input a date at all. I have also tried to create a trigger delay and did not have any success.



function onEdit(event) 

var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();


if(s.getName() == "Terminations" && r.getColumn() == 1 && r.getValue() == "Completed")
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Processed Terminations");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);




In Column C, I would like the a timestamp to be inserted when a row is marked as "Complete"










share|improve this question
















When the status in Column A is changed to "Completed" the row is being moved to another tab called "Archive". I have tried to edit my existing script to insert a timestamp in Column C when the status is changed to "Completed", however the script runs too fast and doesn't insert the timestamp.



I have tried to insert a delay function after the getRange function, but it did not input a date at all. I have also tried to create a trigger delay and did not have any success.



function onEdit(event) 

var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();


if(s.getName() == "Terminations" && r.getColumn() == 1 && r.getValue() == "Completed")
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Processed Terminations");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);




In Column C, I would like the a timestamp to be inserted when a row is marked as "Complete"







google-apps-script






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 17:33









Cooper

13.3k3 gold badges9 silver badges33 bronze badges




13.3k3 gold badges9 silver badges33 bronze badges










asked Mar 28 at 15:30









MariahMariah

34 bronze badges




34 bronze badges















  • This code doesn't even try to write to the spreadsheet - it just moves a row. stackoverflow.com/help/mcve && stackoverflow.com/help/how-to-ask

    – tehhowch
    Mar 28 at 15:56

















  • This code doesn't even try to write to the spreadsheet - it just moves a row. stackoverflow.com/help/mcve && stackoverflow.com/help/how-to-ask

    – tehhowch
    Mar 28 at 15:56
















This code doesn't even try to write to the spreadsheet - it just moves a row. stackoverflow.com/help/mcve && stackoverflow.com/help/how-to-ask

– tehhowch
Mar 28 at 15:56





This code doesn't even try to write to the spreadsheet - it just moves a row. stackoverflow.com/help/mcve && stackoverflow.com/help/how-to-ask

– tehhowch
Mar 28 at 15:56












1 Answer
1






active

oldest

votes


















0
















Try this:



function onEdit(event) 

var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();


if(s.getName() == "Terminations" && r.getColumn() == 1 && r.getValue() == "Completed")
event.range.getSheet().getRange(event.range.rowStart,3).setValue(Utilities.formatDate(new Date(), Session.getTimeZone(), "MM/dd/yyyy HH:mm:ss"));
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Processed Terminations");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);







share|improve this answer

























  • Thank you so much!! This works perfectly!!

    – Mariah
    Apr 1 at 14:30











  • Also, how do you have the cursor as flowers?? so cute!

    – Mariah
    Apr 1 at 14:31













Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55401435%2fdelaying-on-edit-function-to-insert-timestamp%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0
















Try this:



function onEdit(event) 

var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();


if(s.getName() == "Terminations" && r.getColumn() == 1 && r.getValue() == "Completed")
event.range.getSheet().getRange(event.range.rowStart,3).setValue(Utilities.formatDate(new Date(), Session.getTimeZone(), "MM/dd/yyyy HH:mm:ss"));
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Processed Terminations");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);







share|improve this answer

























  • Thank you so much!! This works perfectly!!

    – Mariah
    Apr 1 at 14:30











  • Also, how do you have the cursor as flowers?? so cute!

    – Mariah
    Apr 1 at 14:31















0
















Try this:



function onEdit(event) 

var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();


if(s.getName() == "Terminations" && r.getColumn() == 1 && r.getValue() == "Completed")
event.range.getSheet().getRange(event.range.rowStart,3).setValue(Utilities.formatDate(new Date(), Session.getTimeZone(), "MM/dd/yyyy HH:mm:ss"));
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Processed Terminations");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);







share|improve this answer

























  • Thank you so much!! This works perfectly!!

    – Mariah
    Apr 1 at 14:30











  • Also, how do you have the cursor as flowers?? so cute!

    – Mariah
    Apr 1 at 14:31













0














0










0









Try this:



function onEdit(event) 

var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();


if(s.getName() == "Terminations" && r.getColumn() == 1 && r.getValue() == "Completed")
event.range.getSheet().getRange(event.range.rowStart,3).setValue(Utilities.formatDate(new Date(), Session.getTimeZone(), "MM/dd/yyyy HH:mm:ss"));
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Processed Terminations");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);







share|improve this answer













Try this:



function onEdit(event) 

var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();


if(s.getName() == "Terminations" && r.getColumn() == 1 && r.getValue() == "Completed")
event.range.getSheet().getRange(event.range.rowStart,3).setValue(Utilities.formatDate(new Date(), Session.getTimeZone(), "MM/dd/yyyy HH:mm:ss"));
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Processed Terminations");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);








share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 28 at 17:46









CooperCooper

13.3k3 gold badges9 silver badges33 bronze badges




13.3k3 gold badges9 silver badges33 bronze badges















  • Thank you so much!! This works perfectly!!

    – Mariah
    Apr 1 at 14:30











  • Also, how do you have the cursor as flowers?? so cute!

    – Mariah
    Apr 1 at 14:31

















  • Thank you so much!! This works perfectly!!

    – Mariah
    Apr 1 at 14:30











  • Also, how do you have the cursor as flowers?? so cute!

    – Mariah
    Apr 1 at 14:31
















Thank you so much!! This works perfectly!!

– Mariah
Apr 1 at 14:30





Thank you so much!! This works perfectly!!

– Mariah
Apr 1 at 14:30













Also, how do you have the cursor as flowers?? so cute!

– Mariah
Apr 1 at 14:31





Also, how do you have the cursor as flowers?? so cute!

– Mariah
Apr 1 at 14:31




















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55401435%2fdelaying-on-edit-function-to-insert-timestamp%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현