Write a Weekly Report with AI: Turn CSV Work Logs into a Checked Draft
Use AI to draft a weekly report from CSV work logs and Python to reconcile hours and completed tasks. Copy a prompt that separates completed, ongoing, planned, and blocked work.
Content checked 2026.09.23Example code included
Show contents
Who this is forFor people who keep short daily work logs and want AI to draft weekly reports without losing control of hours, counts, and factual details.
What you need
Python 3.12
A plain CSV file containing the daily work log
01Why reconcile an AI-written weekly report?
AI is useful for reorganizing terse work notes into readable prose, but it should not be treated as the source of truth for arithmetic. A weekly report can sound coherent while quietly changing a total, counting one activity twice, or presenting a planned task as completed. A safer workflow separates narrative drafting from numerical reconciliation.
Use the work log as the factual source.
Ask the AI to summarize only what appears in the log.
Calculate hours and counts independently from the structured data.
Compare the AI report with the independently calculated totals.
Correct the report before sending or publishing it.
02Start with a small synthetic work log
The following work log is synthetic. Each row records one activity, the hours spent, and whether the activity was completed during the week. Keeping these fields structured makes later reconciliation much easier.
date
task
hours
status
2026-09-14
Clean customer CSV
2.0
completed
2026-09-14
Draft import script
1.5
completed
2026-09-15
Test import script
2.5
completed
2026-09-16
Investigate duplicate IDs
1.0
completed
2026-09-17
Update validation rules
2.0
completed
2026-09-18
Prepare user notes
1.5
in progress
By hand, the hours are 2.0 + 1.5 + 2.5 + 1.0 + 2.0 + 1.5 = 10.5 hours. Five of the six activities have status completed, so the completed-task count is 5. The final activity is still in progress and must not be counted as completed.
03Ask the AI to draft from the log, not from memory
Paste the log into an AI chat assistant and explicitly limit the task to rewriting and organizing the supplied data. Also ask it to state its totals so they can be checked.
Prompt to the AI: Using only the work log below, write a concise weekly report with three parts: work completed, work still in progress, and weekly totals. Do not invent outcomes or tasks. State the total logged hours and the number of completed activities. Keep the original task meanings.
A typical AI answer might say: This week, customer data was cleaned, an import script was drafted and tested, duplicate IDs were investigated, and validation rules were updated. User notes remain in progress. Total logged time was 10.5 hours, with 5 completed activities.
04Keep a structured copy for reconciliation
Save the same synthetic example as work_log.csv with the columns date, task, hours, and status. The reconciliation script should read this source file directly rather than trying to recover numbers from the AI-written prose.
Metric
Expected value from the log
Rows
6
Total hours
10.5
Completed activities
5
In-progress activities
1
This separation is important: the CSV is the evidence, while the weekly report is a presentation of that evidence.
05Recalculate hours and counts with Python
The following Python 3.12 script reads work_log.csv, validates the required fields, totals the hours, counts statuses, and writes a reconciliation report to outputs/weekly_reconciliation.txt. It does not overwrite an existing outputs directory.
python
from pathlib import Path
import csv
input_path = Path("work_log.csv")
output_dir = Path("outputs")
if output_dir.exists():
raise SystemExit("outputs already exists; remove or rename it before running again")
if not input_path.exists():
raise SystemExit("work_log.csv was not found")
required_fields = {"date", "task", "hours", "status"}
rows = []
with input_path.open("r", encoding="utf-8", newline="") as f:
reader = csv.DictReader(f)
if reader.fieldnames is None:
raise SystemExit("CSV has no header")
missing = required_fields - set(reader.fieldnames)
if missing:
raise SystemExit(f"Missing columns: {sorted(missing)}")
for line_number, row in enumerate(reader, start=2):
try:
hours = float(row["hours"])
except ValueError:
raise SystemExit(f"Invalid hours value on line {line_number}")
if hours < 0:
raise SystemExit(f"Negative hours on line {line_number}")
status = row["status"].strip().lower()
if status not in {"completed", "in progress"}:
raise SystemExit(f"Unexpected status on line {line_number}: {status}")
rows.append({
"date": row["date"].strip(),
"task": row["task"].strip(),
"hours": hours,
"status": status,
})
total_hours = sum(row["hours"] for row in rows)
completed_count = sum(row["status"] == "completed" for row in rows)
in_progress_count = sum(row["status"] == "in progress" for row in rows)
output_dir.mkdir()
report_path = output_dir / "weekly_reconciliation.txt"
report = (
f"Rows: {len(rows)}\n"
f"Total hours: {total_hours:.1f}\n"
f"Completed activities: {completed_count}\n"
f"In-progress activities: {in_progress_count}\n"
)
report_path.write_text(report, encoding="utf-8")
print(report, end="")
print(f"Saved: {report_path}")
06Compare the AI report with the calculated values
For this example, the independently expected values are 10.5 total hours and 5 completed activities. Compare those values with every numerical statement in the AI draft.
Check
Log result
AI draft
Decision
Total hours
10.5
10.5
Matches
Completed activities
5
5
Matches
In-progress activities
1
User notes remain in progress
Consistent
Check every number in the AI report against the reconciliation output.
Confirm that completed and in-progress work were not mixed.
Compare task wording with the original log so outcomes were not invented.
If the AI total differs, use the structured log calculation and revise the prose.
07Common mistakes and limits
Summing numbers from the AI report instead of from the original log.
Counting every row as completed even when some rows are still in progress.
Treating several log rows about the same project as one task without defining that counting rule.
Allowing the AI to infer achievements that are not explicitly recorded.
Changing status wording between the log and the script without updating the accepted values.
Ignoring missing rows, invalid hour values, or duplicated entries before calculating totals.
This example counts completed activities by row. A real organization may instead count tickets, deliverables, projects, or milestones, so the counting rule must be defined before reconciliation. The script also checks arithmetic and simple statuses only; it cannot determine whether a work-log entry itself is accurate or whether the reported work quality was sufficient.
Weekly Work Report Prompt That Separates Completed, In Progress, Planned, and Blocked Work
When summarizing a work log into a weekly report, it is better not to mix tasks with different statuses in one paragraph. Requesting separate sections for completed work, work still in progress, next week's plans, and blocking issues makes comparison with the source easier. A blank CSV cell can mean something different from an actual value of 0, so restrict AI from automatically interpreting blanks as zero. Also, asking it to attach the source row number or identifier to each summary item makes it easier to find omissions or duplicates later when reconciling hours and counts with Python.
Prompt
Using the CSV work log below, create a draft weekly work report.
Report structure:
1. Completed work
2. Work in progress
3. Next week's plans
4. Blocking issues or items requiring confirmation
Rules:
- After each item, include the source row number or provided row identifier that supports it.
- Do not arbitrarily change completed work into in-progress work or vice versa.
- If next week's plans are not in the source, do not invent new plans as facts. Write 'No planning information in the source.'
- If no blocking issue is recorded, do not conclude '0 blocking issues.' Instead write 'No blocking issues recorded.'
- Do not automatically convert blank CSV cells into the number 0 or 'none.'
- Preserve source values for hours, counts, completed items, and other numbers. If a calculation is necessary, show the formula as well.
- When combining tasks from different rows, check that the original meaning has not changed.
- At the end, separately list the numeric items to be reconciled with Python under 'Items to verify.'
Execution and verification record
ChatGPT Python tool · Python 3.x · standard library only
The script completed successfully on the exact synthetic work log.
The output reported Rows: 6.
The output reported Total hours: 10.5, matching 2.0 + 1.5 + 2.5 + 1.0 + 2.0 + 1.5.
The output reported Completed activities: 5.
The output reported In-progress activities: 1.
These values match the article's expected-values table and AI-report comparison table.
The script created outputs/weekly_reconciliation.txt with exactly the stated four reconciliation metrics.
work_log.csv remained unchanged after execution.
A second execution stopped with 'outputs already exists; remove or rename it before running again', confirming the stated no-overwrite behavior.
Verification limits
The script verifies recorded hours and status counts but cannot determine whether the original work-log entries are factually complete or accurate.
The counting rule treats each CSV row as one activity, as stated in the article.
An unrelated spreadsheet-runtime warmup warning was emitted by the Python execution environment; it did not affect the article script or its output.
References
The explanations and examples were written for this site. See the official sources below for the related behavior and concepts.
Turn “automate this” into an executable task description. Attach a synthetic sample with no sensitive data and a hand-checked expected result to complete a request for a script that totals work logs by team.
Check an aggregation function with four rows you can calculate by hand and 12 unit tests. Verify not only normal values but also empty input, zero, decimals, and invalid input.
Check an AI report against its source data, recalculate totals and rates, and use a copyable review prompt to flag unsupported claims and overstated causes before submission.
Treat an AI-generated regex as a draft, not a finished rule. Build a small synthetic test table, compare expected and actual matches, revise the pattern, and save a review report before using it on real data.
Learn how to turn short source text into an AI PPT presentation structure without adding unsupported facts, create a prompt for a 6-slide outline with one key message, evidence, speaker notes, and visual suggestions, and manually review numbers, interpretations, images, and sensitive information.