Information technology

Csv headers to list using Python

Python code to automatically list header fields of multiple CSV files. The original use case was related to data warehouse documentation.

A datawarehouse project required documentation for incoming CSV-files. The intent was to list all header fields of tens of CSV files grouped by the file name.

Instead of typing field names routinely one by one to our documentation, I automated the task using Python code. The Python code loops through all CSV files in chosen directory and generates a new text file, where all field names are listed for each CSV file.

Those who understand Python code can take a look to the code in my Github account. The name of the repository is get-csv-headers.

Updated 25th April 2019: Fixed the broken GitHub link.

Leave a comment