Skip to content

Monthly

Move old rows to an Archive sheet

Rows older than your cut-off leave the main table each month, keeping it fast and readable.

Runs
Monthly
Apps
Microsoft Excel
AI
Not needed
Access
Files.ReadWrite

Send this to your assistant

Create a ClickRuntime automation: on the 1st of each month, move rows in my Orders table with a Date older than 90 days to the Archive sheet.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

Operational workbooks get heavy. A support log that started with fifty rows now holds twenty thousand, the file takes a full minute to open, formulas lag and filters are cluttered with tickets from two years ago. The team knows the old rows should move somewhere, but nobody wants to do it by hand, and cutting and pasting risks losing records or breaking the formulas that depend on the table.

Once a month, ClickRuntime reads the rows in your main table, finds those older than the number of days you choose, adds them to an archive table and deletes the originals from the main one. Then it emails you the count of rows moved, so you know it ran.

It suits teams with growing logs, trackers or order lists that need to stay fast while keeping their history.

What you get out of it

  • The workbook stays quick to open

    Moving thousands of old rows out keeps the file small. People spend less time waiting for Excel and more time working with current data. A smaller file also means fewer crashes and less frustration.

  • History is kept, not deleted

    Rows go into an archive table before they leave the main one, so you can still look up an old case or answer an audit question. Nothing is thrown away.

  • Formulas and charts stay accurate

    With only recent rows in the main table, totals and charts describe the current period. People are not confused by figures that mix this month with three years ago. That makes month-to-month comparisons clearer.

  • No risky manual cutting and pasting

    A person moving rows can easily skip some, paste them wrongly or delete the wrong range. An automated move applies the same rule every time. That also makes the process easier to trust.

  • A monthly rhythm prevents backlog

    Small regular moves are easier than a yearly cleanup of enormous size. The file never grows to the point where it becomes a project to fix. Routine maintenance beats occasional heroic cleanups.

  • A count confirms what happened

    The email states how many rows were archived. If the number looks wrong, such as zero for a month with lots of activity, you can check the file before the problem grows.

How it works

What happens, step by step

  1. Once a month, ClickRuntime reads the rows in your main Excel table.

  2. It picks out rows older than your cut-off, such as a year.

  3. It copies them to the Archive table, then removes them from the main table.

  4. You get an email saying how many rows were moved.

Before it runs live

  • Connect Microsoft Excel

What you get

RunsMonthly
Move old rows to an Archive sheettoday, 9:00Succeeded
Email · Old rows archivedMoved 318 rows older than 365 days to Archive.

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Microsoft Excel steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
archive_old_rows.pyexample
from datetime import date, timedelta
from clickruntime import on_trigger, credentials, http, notify

BOOK = "https://graph.microsoft.com/v1.0/me/drive/items/01ABCDEF.../workbook/tables"
KEEP_DAYS = 365

@on_trigger
def run(event):
    h = {"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}
    rows = http.get(f"{BOOK}/Orders/rows", headers=h).json()["value"]
    excel_cutoff = (date.today() - timedelta(days=KEEP_DAYS) - date(1899, 12, 30)).days  # column A holds an Excel date
    old = [i for i, r in enumerate(rows) if isinstance(r["values"][0][0], (int, float)) and r["values"][0][0] < excel_cutoff]
    if not old:
        return {"archived": 0}
    http.post(f"{BOOK}/Archive/rows/add", headers=h, json={"values": [rows[i]["values"][0] for i in old]}).raise_for_status()
    for i in reversed(old):
        http.delete(f"{BOOK}/Orders/rows/itemAt(index={i})", headers=h)
    notify.email_me("Old rows archived", f"Moved {len(old)} rows older than {KEEP_DAYS} days to Archive.")
    return {"archived": len(old)}

FAQ

Common questions

How does it decide which rows are old?
It looks at a date column you choose, such as created date or closed date, and compares it with today minus the number of days you set. Rows older than that cutoff are moved to the archive.
Is it safe to delete the originals?
Rows are first added to the archive table and removed from the original only afterwards. As an extra precaution, you can ask for a copy of the workbook to be saved before the first run so you have a restore point.
Can I archive only rows with a certain status?
Yes. You can add a condition, for example archiving only rows marked closed or complete. Open items stay in the main table however old they are, which is often what teams actually want. That is useful when work is still open.
What permissions does it need?
Files.ReadWrite. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (monthly). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Move old rows to an Archive sheet” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.