Automate Office Work with Python and SQL: Save Hours Every Week

Count how many hours a week you spend on work like this: copying numbers from one Excel file into another, renaming dozens of report files, sending nearly identical emails to many...

Automate Office Work with Python and SQL: Save Hours Every Week
Advertisement

Count how many hours a week you spend on work like this: copying numbers from one Excel file into another, renaming dozens of report files, sending nearly identical emails to many people, or waiting for the IT team to pull sales data. If the answer is more than two hours, a good part of that work can probably be automated.

The two most useful tools for the job are Python, for automating repetitive tasks, and SQL, for retrieving and analyzing data. Both can be learned without a computer science background.

Python: let the computer handle the repetition

Python is popular for automation because its syntax is easy to read and there are plenty of ready-made libraries. A simple example: renaming every PDF in a folder so it starts with today's date.

Advertisement
from pathlib import Path
from datetime import date

folder = Path("reports")
for i, file in enumerate(sorted(folder.glob("*.pdf")), start=1):
    file.rename(folder / f"{date.today()}_report_{i:02}.pdf")

These few lines can replace many minutes of manual work. The same pattern applies to other tasks:

  • Excel: read dozens of summary files, add up the numbers, and produce one report with openpyxl.
  • Email: send personalized emails to a recipient list from a spreadsheet.
  • Web data: collect information from web pages on a schedule.

All of these are covered step by step in the e-book Practical Python for Automation (in Indonesian). It teaches the Python basics you really need for automation, then applies them directly to everyday office work.

SQL: ask the database directly

Almost all company data, from transactions and customers to inventory, lives in a database. SQL is the language for getting answers out of it, so you no longer need to wait for someone to export data and then process it by hand in Excel.

For example, to see this month's top five products by revenue:

Advertisement
SELECT p.name, SUM(d.qty * d.price) AS revenue
FROM sale_items d
JOIN products p ON p.id = d.product_id
WHERE d.sold_at >= '2026-11-01'
GROUP BY p.name
ORDER BY revenue DESC
LIMIT 5;

Once basics like JOIN and GROUP BY are solid, the next step is CTEs and window functions for trends, rankings, and month-over-month growth. These skills often appear in data analyst hiring tests.

SQL for Data Analysts teaches all of this using a realistic online-store sales dataset, so the queries are easy to relate to real work.

Combining Python and SQL

The real power appears when you combine them: SQL fetches the data and Python processes and sends the results. For example, a weekly sales report that is generated every Monday morning and emailed to your manager without you touching it.

Where to start?

  • If your work is mostly Excel and files: start with Python.
  • If you are often asked for data from systems or apps: start with SQL.
  • If you want a career as a data analyst: learn both, starting with SQL.

Still more comfortable with spreadsheets? Excel for Office Work and Using AI for Office Work can bridge the gap before you start coding.

Advertisement

Bundle

Practical Python for Automation and SQL for Data Analysts cost Rp35,000 each. If you also want to learn web application development, the Programmer Bundle includes Python, SQL, and Laravel from Zero to Deployment for Rp84,000 (Rp105,000 if bought separately). Prices may change during promotions, so check the BukuPraktis promo page.

Closing thoughts

Automation doesn't have to start with a big project. Pick the one repetitive task that eats the most time this week and try to automate it. The hours you save can go to more valuable work.

Advertisement
otomasi kerja kantor Python otomasi Excel belajar SQL analis data BukuPraktis
Share this article
Back to Blog
🚀 Partner Recommendation

Need Premium Source Code & Business Apps?

Access Laravel applications, POS systems, School Management, Clinic Software, ERP solutions, and ready-to-use premium source code at GudangCode.

GudangCode
  • ✔ Premium Source Code
  • ✔ Ready-to-Use Systems
  • ✔ Lifetime Updates
  • ✔ Lifetime Membership
  • ✔ Daily App Updates
Join Membership →
Advertisement
Advertisement