Python Office Automation: First Project for Sri Lanka

A first Python office-automation project should remove one repetitive task while making errors visible. For a Sri Lankan learner, validating a fictional sales file is a useful exercise: it combines file reading, data checks and a result another person can inspect.
Work on sample files first. Do not point an unreviewed script at important business records.
Define the input and output
Use a CSV file with a unique row ID, quantity and unit price. State that this beginner example accepts positive whole quantities and non-negative prices.
| row_id | quantity | unit_price |
|---|---|---|
| A1 | 2 | 350.00 |
| A2 | 3 | 200.00 |
| A3 | 1 | 125.50 |
The expected total for these fictional rows is LKR 1,425.50. Write that down before coding.
The script should stop with a useful error when the file contains a duplicate ID or invalid value. Silently producing a partial total could mislead the next person.
Read the file with the standard library
Python's CSV documentation describes DictReader and the recommended newline handling. Save the sample as sales.csv beside this script:
import csv
from decimal import Decimal
seen = set()
total = Decimal("0")
with open("sales.csv", newline="", encoding="utf-8") as source:
for line, row in enumerate(csv.DictReader(source), start=2):
row_id = row["row_id"].strip()
quantity = int(row["quantity"])
price = Decimal(row["unit_price"])
if not row_id or row_id in seen:
raise ValueError(f"Invalid or repeated ID on line {line}")
if quantity <= 0 or not price.is_finite() or price < 0:
raise ValueError(f"Invalid amount on line {line}")
seen.add(row_id)
total += quantity * price
print(f"Checked {len(seen)} rows; total LKR {total:.2f}")
Run it with your installed Python 3 interpreter from that folder. This is a small validation example, not a complete accounting system.
Test the failure cases
Change one row to repeat A1 and confirm that the script stops. Try a missing ID, a negative price and a non-numeric quantity.
The example lets Python raise an error for malformed numbers or missing columns. A later version could catch those errors and produce a clearer report, but it should not hide them.
Add an empty-file check if your workflow requires at least one record. The expected behaviour depends on the actual task.
Keep an audit trail
Preserve the original input and record which file was processed. If you later write a cleaned output, save it as a separate file rather than overwriting the source.
Document assumptions about returns, discounts and rounding before adding them. The sample deliberately does not model those business rules.
For money, agree on the required rounding policy with the responsible team. Printing two decimal places is a display choice, not a complete financial policy.
Present the project clearly
Write a README with the sample file, run command, expected output and tested failures. Explain what you automated and what still needs human review.
A useful next step is a report listing invalid rows without changing them. Another is a command-line argument for the input path.
Avoid adding email delivery or automatic file deletion until the basic validation is reliable and those actions are explicitly required.
Do you need a large library for this project?
The standard library is sufficient for the small CSV example. Add dependencies when they solve a concrete need.
Why use fictional data?
It lets you publish and test the project without exposing business or customer information.
Does a correct total prove the data is complete?
No. You still need to know whether the input contains all required records and represents the right period.
What should an interviewer learn from this project?
They should see clear assumptions, checked calculations, visible failures and respect for the original data.
Related guides
- SQL Interview Practice in Sri Lanka: Questions and Checks
- Power BI Portfolio in Sri Lanka: Build a Useful Dashboard
- No-Code Automation in Sri Lanka: Plan Your First Workflow
Browse the Sri Lanka work and technology guides for more practical application, AI and workplace projects.
Related articles
About the author
App Dev Sri Lanka prepared this guide with AI assistance, original examples and the linked primary sources. The collection was informed by Google Trends research for Sri Lanka on 2 September 2026. Illustrations depict fictional people. Examples are educational; this article is not a live vacancy notice or an employer endorsement.
Learn more about App Dev Sri Lanka



