Wednesday, January 5, 2011

Text File Line Trimmer App

Most programs solve a business problem and that is true in this case. Import files such as comma-separated value "CSV" files generally come in two flavors - either with a first line header row containing column names, or without a header row. I had sixty CSV files that followed neither rule. In each file the first line was a single string containing the name of the elementary school the data belonged to. When opened in Excel it looks like the screenshot below, the offending first line highlighted.


The goal was to delete the bad line in each file and then proceed with the data import. I wrote a windows app that will trim one or more leading lines (in my case 1 line) in all text files in a specified folder. The result is a single EXE, written in C# (.NET 3.5 platform). Click here to download.

0 comments:

Post a Comment