Skip to content

Every 15 minutes

Import new CSV files into an Excel table

When a CSV lands in your OneDrive folder, its rows are added to your Excel table automatically.

Runs
Every 15 minutes
Apps
Microsoft Excel, OneDrive
AI
Not needed
Access
Files.ReadWrite

Send this to your assistant

Create a ClickRuntime automation: every 15 minutes, check my OneDrive Imports folder for new CSV files and add their rows to the Data table in my Excel workbook.

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

Many tools only offer a CSV export: the bank, the shop, the booking system. Someone downloads it, opens Excel, copies the rows across and fixes the formatting, every week, and occasionally pastes the same file twice.

Dropping the CSV into a OneDrive folder and letting the rows flow into your Excel table removes the copy and paste, keeps the format consistent, and makes sure each file is imported once.

What you get out of it

  • No copy and paste

    Save the CSV into the folder and you're done. The rows appear in your table within 15 minutes.

  • Each file imported once

    Files already imported are remembered. Dropping the same export twice won't double your numbers.

  • Formulas keep working

    Rows go into an Excel table, so formulas, charts and pivot tables extend to include them.

  • Works from anywhere

    Save the file from your phone, another computer or a colleague's account. If it lands in the folder, it's imported.

How it works

What happens, step by step

  1. Every 15 minutes it checks your OneDrive folder for new or changed CSV files.

  2. Each new CSV is downloaded and its header row is skipped.

  3. The rows are added to the table in your Excel workbook.

  4. It keeps track of what it has already seen in the folder, so each file is imported only once.

Before it runs live

  • Connect Microsoft Excel
  • Connect OneDrive

What you get

RunsEvery 15 minutes
Import new CSV files into an Excel tabletoday, 9:00Succeeded
Excel · Data tablebank-export-oct.csv imported: 214 rows added

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

  • Act only on the items that match your own rules, and skip the rest
  • 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 and OneDrive 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.
import_csvs_from_onedrive_into_an_excel_table.pyexample
GRAPH = "https://graph.microsoft.com/v1.0"
import csv, io
from clickruntime import on_trigger, credentials, http, state, report_fetched

FOLDER = "/me/drive/root:/Imports"
TABLE = "/me/drive/root:/Data/data.xlsx:/workbook/tables/Data/rows/add"
COLS = 5

@on_trigger
def run(event):
    h = {"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}
    url = state.get("delta") or f"{GRAPH}{FOLDER}:/delta"
    files, page = [], {}
    while url:
        page = http.get(url, headers=h).json()
        files += [f for f in page["value"] if f.get("file") and f["name"].lower().endswith(".csv") and not f.get("deleted")]
        url = page.get("@odata.nextLink")
    report_fetched(len(files))
    if not files:
        state.set("delta", page.get("@odata.deltaLink"))
        return {"summary": "Nothing new"}
    added = 0
    for f in files:
        text = http.get(f"{GRAPH}/me/drive/items/{f['id']}/content", headers=h).content.decode("utf-8-sig")
        rows = [(r + [""] * COLS)[:COLS] for r in list(csv.reader(io.StringIO(text)))[1:] if any(r)]
        if rows:
            http.post(f"{GRAPH}{TABLE}", headers=h, json={"values": rows}).raise_for_status()
            added += len(rows)
    state.set("delta", page.get("@odata.deltaLink"))
    return {"files": len(files), "rows": added}

FAQ

Common questions

Do the CSV columns need to match the table?
They should be in the same order as the table columns. Extra columns in the CSV are ignored and missing ones are left blank.
Does it skip the header row?
Yes. The first row of each CSV is treated as headers and not added.
Can it update existing rows instead of adding them?
It can if each row has an ID column. Rows with an ID already in the table are updated; new IDs are added.
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 checks. Checks that find nothing new 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 “Import new CSV files into an Excel table” from your assistant

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