|
-
May 26th, 2011, 03:48 PM
#1
Thread Starter
New Member
vbscript to delete columns from csv
Hi, I'm new to the forum and have a question about looping through rows to check for values at specific columns.
I have a csv file with 20 some columns and hundreds of rows. Basically, what I want to do is delete all the rows where column 12 is 1 or column 15 is a 1. I've seen many examples of how to delete some arbitrary row or search for some arbitrary string but nothing about checking for a string at a specific spot (like "1" in column 12) and then deleting that row. What I'd really like to know is how to reference a specific column - something like "elementAt(12)" - so I can create conditionals.
Any help would be appreciated.
Also, I'd like this to be done in a new CSV file. Thanks!
-
May 29th, 2011, 06:16 PM
#2
Addicted Member
Re: vbscript to delete columns from csv
Use FileSystemObject methods to read and create a text file (the .csv file). Use the VBScript Split function to split each record (row) into an array of separate fields (columns) and then you can test the array elements as required.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|