Does Google Apps Script Remember Between Executions?
Does Google Apps Script Remember Between Executions? No. A Google Apps Script execution carries no memory from one run to the next. Every function call, whether it comes from a time-driven trigger, a menu click, a web app request, or another script, starts in a fresh execution context. Variables reset to the values written in the code, and anything the previous execution worked out in memory is gone. The schedule can feel continuous. A trigger fires every hour, the same function runs, and the
Does Google Apps Script Remember Between Executions?
No. A Google Apps Script execution carries no memory from one run to the next. Every function call, whether it comes from a time-driven trigger, a menu click, a web app request, or another script, starts in a fresh execution context. Variables reset to the values written in the code, and anything the previous execution worked out in memory is gone.
The schedule can feel continuous. A trigger fires every hour, the same function runs, and the same spreadsheet fills up row by row. That continuity lives in the trigger definition and in whatever the script deliberately saved to a store. It does not live in the execution itself.
What does one execution actually hold?
Inside a single execution, a script holds plenty. Local and global variables keep values while the function runs, objects built from spreadsheet ranges, API responses, and intermediate results all stay available, and one function can pass its results to the next within the same run.
That working context is scoped to the execution. When the function finishes, the context is discarded. A global variable that was incremented during the morning run reads as its starting value again in the afternoon run, because the global scope is recreated each time. No later execution can ask what an earlier execution calculated, unless the earlier execution wrote that answer somewhere outside itself.
What persists between executions, and where?
Three built-in stores survive, and each one keeps a narrow kind of thing.
PropertiesService is the durable one. It stores simple key-value pairs as strings, scoped to the script, to the current user, or to a document. A script can save a value such as the last row processed or the date of the last successful sync, and the next execution can read it back hours or days later. The limits define what it is for: each value is capped at 9 KB, and each property store holds 500 KB in total. That is room for settings, markers, and small pieces of state, not for a history of what happened.
CacheService is the temporary one. It also stores key-value strings, up to about 100 KB per value, but every entry expires. The default lifetime is 10 minutes, and the longest allowed lifetime is 6 hours. Cache suits values that are expensive to rebuild and safe to lose, such as a fetched price list. It is not a place to keep anything the next scheduled run must find.
The spreadsheet itself is the third store, and the one most scheduled automations lean on. A script can write a log row, update a status cell, or append results to a sheet, and the next execution can read the sheet back. That works, and it is visible and editable. It also means the memory of the automation is a grid of cells that the script has to parse, filter, and interpret on every run, with no search beyond what the code builds by hand.
The gap an AI step falls into
Add an AI step to a scheduled Apps Script automation and the shape of the gap becomes clear. Picture an hourly script that pulls new form responses, asks a model to classify each one and draft a follow-up, and writes the results to a sheet.
On the second run, the sheet shows what was written. It does not show why the model classified a response the way it did, which earlier responses shaped the tone of the drafts, what the model decided about a borderline case last week, or what a different automation concluded about the same sender. The script can save a label in a property or a row in a sheet. The reasoning, the decisions, and the thread of prior work are conversation context, and none of the three stores were built to hold or retrieve that.
So the AI step wakes up blank in the way that matters. It can be re-briefed from cells and properties every run, at the cost of more code, more tokens, and a briefing that only ever contains what someone remembered to save as a string under 9 KB.
What changes when memory lives outside the script
Vilix AI is a cloud-hosted memory layer that sits outside any single script, so there is no infrastructure to run alongside your automations. A scheduled agent connects to Vilix AI over MCP. At the start of a run it retrieves the relevant saved context, and at the end it saves what it did and decided.
That memory holds full conversation history, not just facts or final values, so a later run can revisit what was actually said, tried, and concluded, not only the label that survived. The same memory follows the work everywhere: the same saved context is available to an agent in Apps Script, to an agent in another automation platform, and to the AI tools used during the day, because every one of them connects to the same layer over MCP.
For the form-response automation, the difference is concrete. Run two no longer starts from a status cell. It retrieves the prior classifications, the borderline calls and the reasons behind them, and the follow-up thread for each sender, then saves the new decisions back for run three. The script keeps doing what Apps Script does well, which is scheduling, reading Google services, and writing results. The memory of the work stops depending on properties and cells.
Getting started is light. Vilix AI offers a free plan forever, a 7-day Pro trial with no credit card, and the ability to export everything or delete it anytime, so the memory an automation builds stays portable and under the operator's control.
The short answer
Google Apps Script does not remember between executions. An execution starts fresh, variables reset, and only what a script saves to PropertiesService, CacheService, or a sheet survives, each within tight size and lifetime limits and none of it shaped like an agent's past work. Scheduled automations that include AI steps need a memory layer built for that past work. Give the agent one shared memory outside the script, and each run starts from what the last run learned instead of from a blank context and a status cell.