Status Update
Comments
jp...@google.com <jp...@google.com> #2
To help us understand the issue, please ensure you have provided a minimal code example that reproduces the problem, including the API calls, errors, and responses you're seeing.
Generated Metadata
- Summary: The user reports that their Apps Script time-based trigger, set to run between 11 PM and midnight, is also unexpectedly running at 11 AM, resulting in a timeout error. This could be an issue with the trigger scheduling or time zone settings.
- Tags:
Additional resources:
https://stackoverflow.com/.../time-driven-trigger-fired-multiple-times-all-th... https://stackoverflow.com/questions/.../script-runtime-execution-time-limit https://developers.google.com/apps-script/guides/support/troubleshooting https://stackoverflow.com/questions/.../setting-the-timezone-for-timed-trigg... https://stackoverflow.com/.../google-apps-script-trigger-timezone-will-not-c...
You can
pr...@gmail.com <pr...@gmail.com> #3
function saveDailyValue() { // Get the spreadsheet and sheets. var ss = SpreadsheetApp.getActiveSpreadsheet(); var sourceSheet = ss.getSheetByName("MasterSheet"); // Replace "Sheet1" with the name of your sheet containing the dynamic value. var targetSheet = ss.getSheetByName("DailyData"); // Replace "DailyData" with the name of the sheet to store the values.
// Get the dynamic value. Adjust the cell reference as needed (e.g., "A1", "B2"). var dynamicValue = sourceSheet.getRange("P1").getValue(); // Assuming the dynamic value is in cell A1. var roundedValue = Math.round(dynamicValue);
// Get today's date (formatted as you prefer). var today = new Date(); var formattedDate = Utilities.formatDate(today, "GMT", "yyyy-MM-dd"); // Example: YYYY-MM-DD. Customize the format as needed.
// Append the date and the value to the target sheet. targetSheet.appendRow([formattedDate, roundedValue]);
Logger.log("Value saved: " + dynamicValue + " on " + formattedDate); // For debugging (view logs in "View" > "Logs"). }
This is the code I'm triggering everyday. There is no error here. I'm getting trigger error, I've attached the error message here. Second problem is, that query ideally should not have ran on AM time as I've set it for 11PM to Midnight frequency. (See the screenshot of trigger configuration)
Description
Before opening a new issue, please search for other related issues , click the ★ to subscribe to updates, and click
+1
to vote.Description: My trigger is from 11 PM to Midnight. Its running at that time properly but it also ran on 11AM today in the morning and gave time out error.
Code
Output
Steps