Results 1 to 2 of 2

Thread: vbscript to delete columns from csv

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    1

    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!

  2. #2
    Addicted Member
    Join Date
    Jul 2009
    Posts
    208

    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
  •  



Click Here to Expand Forum to Full Width