Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #11460
| From | "Dave \"Crash\" Dummy" <invalid@invalid.invalid> |
|---|---|
| Newsgroups | microsoft.public.scripting.vbscript |
| Subject | Re: vb script to read csv file and put each value (column) in separate text file |
| Date | 2016-11-29 16:52 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <o1kt8p$dla$1@dont-email.me> (permalink) |
| References | <6ad41c22-4e5c-4633-811a-c3a027deaeef@googlegroups.com> <o1k9ph$gp$1@dont-email.me> <92d0ad7c-6759-4f79-a3c0-a1792a40e2f2@googlegroups.com> <o1ki17$qq$1@dont-email.me> |
Here. One size fits all. This script will take a CSV file and spit out
files for rows, columns, and cells. Take your pick. Comment out the
ones you don't want.
set fso=CreateObject("Scripting.FileSystemObject")
set inFile=fso.OpenTextFile("example.csv")
csv=inFile.readAll
inFile.close
set inFile=nothing
rows=split(csv,vbCRLF)
cols=split(rows(0),",")
dim heads()
redim heads(ubound(cols))
for n=0 to ubound(cols)
set heads(n)=fso.CreateTextFile("Col_" & n & ".txt")
next
for m=0 to ubound(rows)
if len(rows(m)) then
set row=fso.CreateTextFile("Row_" & m & ".txt")
row.writeLine rows(m)
row.close
set row=nothing
for n=0 to ubound(cols)
set cel=fso.CreateTextFile("Cell_" & m & "x" &n&".txt")
cel.writeLine split(rows(m),",")(n)
cel.close
set cel=nothing
heads(n).writeLine split(rows(m),",")(n)
next
end if
next
for n=0 to ubound(cols)
heads(n).close
set heads(n)=nothing
next
--
Crash
"Never underestimate the power of the Dark Side."
~ Obi-Wan Kenobi ~
Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar
vb script to read csv file and put each value (column) in separate text file Christian Ort <christian.ort@gmail.com> - 2016-11-29 07:09 -0800
Re: vb script to read csv file and put each value (column) in separate text file "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2016-11-29 11:20 -0500
Re: vb script to read csv file and put each value (column) in separate text file Christian Ort <christian.ort@gmail.com> - 2016-11-29 09:03 -0800
Re: vb script to read csv file and put each value (column) in separate text file "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2016-11-29 13:40 -0500
Re: vb script to read csv file and put each value (column) in separate text file "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2016-11-29 16:52 -0500
Re: vb script to read csv file and put each value (column) in separate text file Christian Ort <christian.ort@gmail.com> - 2016-11-30 02:37 -0800
Re: vb script to read csv file and put each value (column) in separatetext file "R.Wieser" <address@not.available> - 2016-11-29 18:35 +0100
csiph-web