On a schedule
Save a monthly KPI report to OneDrive and email the link
On the 1st of each month a report with last month's numbers and a short commentary is saved to OneDrive and the link is emailed to your team.
- Runs
- On a schedule
- Apps
- OneDrive, Outlook
- AI
- Yes, uses the built-in AI allowance
- Access
- Files.ReadWrite, Mail.Send
Send this to your assistant
Create a ClickRuntime automation: on the 1st of every month, pull last month's KPIs, write a short commentary, save the report to OneDrive under Reports, and email the share link to the management team from Outlook.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Monthly reporting tends to fall to one person who spends a day gathering numbers, writing a few paragraphs and emailing a file around. It often goes out late, and older reports are scattered across inboxes.
Producing the report automatically on the 1st, with commentary drafted for you, gets it out on time every month and keeps every edition in one OneDrive folder, so comparing this month with last year takes seconds.
What you get out of it
On time every month
The report is ready on the 1st without anyone blocking out a day. Managers can plan around it.
Commentary drafted for you
AI writes a short summary of what changed and why it matters. You can edit it before discussing it.
Every report in one place
Each month's file is saved in the same OneDrive folder. Looking back at older months is easy.
A link, not an attachment
People get a link to the file, so everyone opens the same version and nothing bloats inboxes.
How it works
What happens, step by step
On the 1st of each month it fetches last month's figures.
AI writes a short commentary on the main changes.
The figures and commentary are saved as a report in your OneDrive Reports folder.
A share link limited to your organisation is created.
The link is emailed to your management team from Outlook.
Before it runs live
- Connect OneDrive
- 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
- Run it at a different time, more or less often, or only on weekdays
- 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 OneDrive and Outlook steps into one automation
Under the hood
The code that runs this automation
GRAPH = "https://graph.microsoft.com/v1.0"
from datetime import date, timedelta
from clickruntime import on_trigger, credentials, http, ai
DATA_URL = "https://reports.example.com/kpis/last-month"
TEAM = ["ops@example.com", "finance@example.com"]
@on_trigger
def run(event):
kpis = http.get(DATA_URL, headers={"Authorization": f"Bearer {credentials.secret('METRICS_TOKEN')}"}).json()
month = (date.today().replace(day=1) - timedelta(days=1)).strftime("%Y-%m")
figures = "\n".join(f"{k}: {v}" for k, v in kpis.items())
note = ai.generate(figures, system="Write a 3-sentence plain commentary on these monthly business figures.", max_output_tokens=200).text
h = {"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}
item = http.put(f"{GRAPH}/me/drive/root:/Reports/KPI-{month}.txt:/content", headers=h,
data=f"KPI report {month}\n\n{figures}\n\n{note}".encode()).json()
link = http.post(f"{GRAPH}/me/drive/items/{item['id']}/createLink", headers=h,
json={"type": "view", "scope": "organization"}).json()["link"]["webUrl"]
mail = {"message": {"subject": f"KPI report {month}", "body": {"contentType": "Text", "content": f"{note}\n\nFull report: {link}"},
"toRecipients": [{"emailAddress": {"address": a}} for a in TEAM]}}
http.post(f"{GRAPH}/me/sendMail", headers=h, json=mail).raise_for_status()
return {"month": month}FAQ
Common questions
Where do the numbers come from?
Who can open the link?
Can I check the commentary before it's sent?
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
Back up a daily export to OneDrive and email the result
Every night an export is saved to a dated OneDrive folder, old copies are cleared out, and you get an email saying it worked.
See how it worksLog feedback in Excel on OneDrive and get an email
Each feedback submission becomes a row in your Excel workbook and you get an email with what was said.
See how it worksSave email attachments to OneDrive folders
Attachments from incoming emails are filed in OneDrive by sender, with a log of every file saved.
See how it worksKeep exploring
Set up “Save a monthly KPI report to OneDrive and email the link” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.