New PrimalToys object for easier CSV handling

With service build 569 of PrimalScript 2007 we added a COM object that makes it easier to deal with CSV (comma separated values) data and/or files.

While browsing through posts at ScriptingAnswers.com and some of Microsoft’s scripting related newsgroups I couldn’t help but notice that questions regarding CSV keep coming up.

I mentioned this to one of our engineers, Stephen Poon, and he created this object that can edit and display CSV files really easily.

The following script is a PowerShell sample, a VBScript sample is included with PrimalScript 2007 (any edition) and the free PrimalToys download at our Free Tools Site

$CSVEdit = New-Object -comObject “SAPIEN.CSVEditor”
$CSVEdit.FirstRowColumnNames = $True
$CSVEdit.DataStartRow = 1
$CSVEdit.ReadOnly = $True
$CSVEdit.Title = “Current Processes Summary”
$CSVEdit.Label=”Processes:” #Text Label for the Grid

get-process | Export-Csv “C:\Temp\process.csv”
$CSVEdit.FileName = “C:\Temp\process.csv”
$CSVEdit.LoadFile()
$CSVEdit.ShowDialog()

Running this will produce this dialog:

image

The object includes a number of methods to insert, remove, extract columns rows or fields with or without displaying the UI.

Check it out and head over to our Free Tools forum at
http://support.sapien.com/forum/forum_topics.asp?FID=10
and let us know what you think and if  there is anything we should add.