Every 30 minutes
Turn emailed PDF timesheets into rows in Excel
PDF timesheets emailed in by contractors are read and their hours added to your Excel timesheet table, and you are told about any that can't be read.
- Runs
- Every 30 minutes
- Apps
- Microsoft Excel, Outlook
- AI
- Yes, uses the built-in AI allowance
- Access
- Mail.Read, Files.ReadWrite
Send this to your assistant
Create a ClickRuntime automation: every 30 minutes, find new emails in Outlook with 'timesheet' in the subject and a PDF attached. Use AI to read the person's name, week and hours per project, add a row per project to my Timesheets table in Excel, and email me if a timesheet can't be read.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A small agency works with a dozen freelancers who send weekly timesheets as PDFs. The office manager types every line into Excel before invoicing clients. It takes a morning each week and errors flow straight into client invoices.
Reading each timesheet as it arrives and adding the hours to Excel cuts the retyping, and the email for unreadable ones makes sure nothing is missed.
What you get out of it
No retyping hours
Hours per project go straight into the timesheet table.
Fewer billing mistakes
Numbers are copied exactly as written, without typing errors.
Nothing missed
Timesheets that can't be read are flagged to you, rather than silently skipped.
Ready for invoicing
The table can feed your client billing as soon as the week's timesheets are in.
How it works
What happens, step by step
Every 30 minutes, ClickRuntime looks in Outlook for new emails with timesheet in the subject and a PDF attached.
AI reads each PDF and pulls out the person's name, the week and the hours per project.
One row per project is added to your Timesheets table in Excel.
If a timesheet can't be read, you get an email with the sender and subject so you can check it.
Before it runs live
- Connect Microsoft Excel
- Connect Outlook
What you get
Build your own
Need it to work differently?
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
- Change what the AI looks for, or how it writes the result
- Add another app, for example also send it to Slack
- Combine it with other Microsoft Excel and Outlook steps into one automation
Under the hood
The code that runs this automation
import base64
import io
from pypdf import PdfReader
from clickruntime import on_trigger, report_fetched, http, credentials, ai, state, notify
def graph(method, path, **kw):
r = http.request(method, "https://graph.microsoft.com/v1.0" + path, headers={"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}, **kw)
return r.raise_for_status() or (r.json() if r.content else None)
pdf_text = lambda b64: " ".join(p.extract_text() or "" for p in PdfReader(io.BytesIO(base64.b64decode(b64))).pages)[:12000]
BOOK = "/me/drive/items/your-workbook-id/workbook"
SCHEMA = {"type": "object", "properties": {"ok": {"type": "boolean"}, "name": {"type": "string"}, "week": {"type": "string"},
"lines": {"type": "array", "items": {"type": "object", "properties": {"project": {"type": "string"}, "hours": {"type": "number"}}}}}}
@on_trigger
def run(event):
since = state.get("since") or "2026-01-01T00:00:00Z"
msgs = graph("GET", "/me/messages", params={"$filter": f"hasAttachments eq true and receivedDateTime gt {since}", "$orderby": "receivedDateTime", "$top": 25})["value"]
msgs = [m for m in msgs if "timesheet" in m["subject"].lower()]
report_fetched(len(msgs))
if not msgs:
return {"summary": "No new timesheets"}
for m in msgs:
for a in graph("GET", f"/me/messages/{m['id']}/attachments")["value"]:
if a.get("contentType") == "application/pdf":
ts = ai.generate(pdf_text(a["contentBytes"]), system="Read this timesheet: person's name, week starting (YYYY-MM-DD), hours per project. "
"Set ok=false if unreadable.", json_schema=SCHEMA, max_output_tokens=300).json
if ts["ok"] and ts["lines"]:
graph("POST", f"{BOOK}/tables/Timesheets/rows/add", json={"values": [[ts["name"], ts["week"], l["project"], l["hours"]] for l in ts["lines"]]})
else:
notify.email_me("Timesheet needs checking", f"{m['from']['emailAddress']['address']}: {m['subject']}")
state.set("since", max(m["receivedDateTime"] for m in msgs))
return {"timesheets": len(msgs)}FAQ
Common questions
What format must timesheets be in?
Can it handle Excel or Word timesheets?
Does it reply to the freelancer?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Add emailed invoices to your Excel register
Invoices emailed to you are read, added as rows in your Excel invoice register, and the PDF is saved to OneDrive.
See how it worksFlag and summarise emails from your VIP list
Emails from anyone on your Excel VIP list are flagged in Outlook and you get a short summary of each, so important messages never wait.
See how it worksGet an Outlook email when a new row is added in Excel
When new feedback or requests are added to your Excel table, you get an email listing them.
See how it worksKeep exploring
Set up “Turn emailed PDF timesheets into rows in Excel” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.