Using Excel to Parse the Input File

Use Excel to overcome the shortcomings of CSV files.

Steve Seguis

June 8, 2003

1 Min Read
ITPro Today logo

The primary advantage of using a comma-separated value (CSV) file to list the Active Directory (AD) object attributes and values you want to update is that most data-exporting tools can generate CSV files. Furthermore, you can easily list the attribute names in the first row, designate that row as a header row, then place the respective values in subsequent rows in an easy-to-read tabular format. The biggest problem with CSV files is parsing out the various fields. By definition, the CSV format uses commas to separate each field. Therefore, any field that contains a comma presents a problem to a script attempting to parse input directly from a CSV file.

Microsoft Excel does a great job of overcoming this problem. Instead of using Windows Shell Scripting or VBScript to manipulate strings, the script can simply use the Excel Application object to open a CSV file and parse the data that it contains. Or, you can use an Excel spreadsheet as your input file. You can also import data from databases or any other file format that Excel supports.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like