Christian Ort
2016-11-29 15:09:16 UTC
Hello,
I'm looking for a small script that is able to split a csv file into multiple text files.
e.g. I've a file "Input.csv" that contains this data:
LA2405w,CN12345678
L2245w,CNU9876543
etc,etc
The output should be 4 or more files, each file containing one column of the csv.
e.g.:
Output1.txt
LA2405w
Output2.txt
CN12345678
Output3.txt
L2245w
Output4.txt
CNU9876543
I've so far this script that is working will for the first line in the csv, but all following lines getting ignored.
Option Explicit
'On error resume next
Dim goFS : Set goFS = CreateObject( "Scripting.FileSystemObject" )
Dim aParts : aParts = split(goFS.OpenTextFile("./Input.txt").ReadLine(), ",")
Dim nF
For nF = 0 To UBound(aParts)
goFS.CreateTextFile(".\Output" & (NF + 1) &".txt").Write aParts(nF)
Next
How can I modify that script to also parse the other lines from Input.csv?
Thanks for any ideas.
I'm looking for a small script that is able to split a csv file into multiple text files.
e.g. I've a file "Input.csv" that contains this data:
LA2405w,CN12345678
L2245w,CNU9876543
etc,etc
The output should be 4 or more files, each file containing one column of the csv.
e.g.:
Output1.txt
LA2405w
Output2.txt
CN12345678
Output3.txt
L2245w
Output4.txt
CNU9876543
I've so far this script that is working will for the first line in the csv, but all following lines getting ignored.
Option Explicit
'On error resume next
Dim goFS : Set goFS = CreateObject( "Scripting.FileSystemObject" )
Dim aParts : aParts = split(goFS.OpenTextFile("./Input.txt").ReadLine(), ",")
Dim nF
For nF = 0 To UBound(aParts)
goFS.CreateTextFile(".\Output" & (NF + 1) &".txt").Write aParts(nF)
Next
How can I modify that script to also parse the other lines from Input.csv?
Thanks for any ideas.