🐍 Conjuring Python code — much easier than I feared (bold for quickly adding lots of historical d...
In the thirty years I've worked with computers, I've collected quite a few files and databases. Whole containers full of old emails from the Outlook era, CSV exports, Excel sheets, Google Calendar archives — you name it.
Potential gold mines. And I kept them on purpose. Not out of procrastination, but because I knew: someday I’ll know how to make smart use of them. Eventually, I’ll have the skills and tools to tinker with them myself.
Strategically lazy as I am, I had already experimented with generating Markdown files from a CSV using ChatGPT. But lately, I kept getting the message: Python parser not available. Shall I write a script for you to run locally?
I’d done that before, successfully. But to be honest, I still didn’t feel entirely comfortable with it. Until last weekend. My curiosity beat my hesitation, and the euphoria when it actually worked... I just have to share that. Because from now on, this is part of my skillset. And I want that for everyone.
Because that “someday”? That’s now. 🎉
Because that “someday”? That’s now. 🎉
Getting started with Python on your Mac
Working on Windows? No problem — the steps are similar. But here’s how it works on a Mac.
Open Terminal
Use Spotlight (Cmd + Space), type Terminal, and press Enter.Check if Python 3 is already installed
Type: python3 --version
If you see a version (like 3.11.x), you're good.If not: install Python via Homebrew
Don’t have Homebrew yet? Install it with:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then install Python with:
brew install pythonCheck again:
python3 --versionStart the interactive shell
Type: python3
You’re now in the live Python environment.Test with a simple line:
print("Hello, world!")Done? Exit like this:
Type exit() or press Ctrl + D.Want to write a script?
Use something like TextEdit or Visual Studio Code. Save the file as script.py.
Make sure to save it in Unicode 8 format.
Run your script in Terminal:
Navigate to the correct folder:
cd ~/Desktop/"Python CSV-Markdown"
And run:
python3 script.py
📁 From CSV to Markdown
What I wanted: to convert each record from my CSV file into its own Markdown file. So not a thousand rows in one file, but a thousand separate files — each with metadata, neatly formatted for use in Obsidian.
I created a folder on my desktop called Python CSV-Markdown and placed the CSV file with my newsletter subscribers in it. The structure of the CSV file was simple:
email addresssubscription datejan@example.com2023-07-28
🧪 The prompt for ChatGPT
I asked: “Write a Python script that...”
...opens the CSV file from the folder /Users/martijn/Desktop/Python CSV-Markdown.
...creates a separate Markdown file for each row.
...builds the filename as:
📰 Subscriber Weekly Update Martijn - 👥 jan@example.com...and starts the content with:
Category: Weekly-Update-Subscriber
Date: 2023-07-28
Email: jan@example.com
Person:
I pasted the generated script into a new text file, named it maak_md.py, saved it in the same folder as the CSV file, and made sure the file encoding was set to UTF-8.
When I ran it, I had a thousand individual Markdown files within three seconds, all of which appear like this in Obsidian:
👀 So what can you do with this?
A whole lot. For example:
Automatically see who receives my newsletter and who I personally know, based on the manually filled Personfield.
Group all subscribers with an @police or @province email address.
Build queries in Obsidian that visualize data I previously had no access to.
Process other datasets — like phone history, calendars, participant lists or Amazon orders — in the same way.
I’ve now found a way to turn old, unstructured data into rich, navigable information. For my PKM system, that’s pure gold.
This way of working transforms my data into a smart network of information — tangible, searchable, and meaningful.
And if I can do it, you definitely can too!