Script to add fields to a csv file
I hope someone can help or point me in the right direction after a frustrating couple of hours trying to find a script to complete this task.
I need to run a process probably hourly (hence the script) to complete the following task...
Open a csv file in location A
Add two extra fields of data (eg data1,data2,) to the beginning of every single line
Save the resulting csv file in location B
I've been looking around at vbs scripts and found the following, but I'm really not very good at vbs to get to the next stage. Thanks in advance.
Sub ConvertFile(strFileName As String)
Dim InFileID As Integer, OutFileID As Integer
Dim strData As String
InFileID = FreeFile
Open strFileName For Input As #InFileID
OutFileID = FreeFile
Open strFileName & ".tmp" For Output As #OutFileID
Do Until EOF(InFileID)
Line Input #InFileID, strData
Print #OutFileID, "data1,data2" & strData
Name strFileName & ".tmp" As strFileName