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;
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
add a comment
|
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
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
add a comment
|
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
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
google-apps-script
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
add a comment
|
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
add a comment
|
1 Answer
1
active
oldest
votes
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);
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
add a comment
|
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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);
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
add a comment
|
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);
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
add a comment
|
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);
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);
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
add a comment
|
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
add a comment
|
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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