Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 156657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:21:57+00:00 2026-05-11T10:21:57+00:00

I have a need to read a CSV file, and the only language I

  • 0

I have a need to read a CSV file, and the only language I can use is VBscript.

I’m currently just opening the file and splitting on commas, and it’s working OK because there aren’t any quoted commas in fields. But I’m aware this is an incredibly fragile solution.

So, is there such a thing as a VBscript module I can use? Somewhere to get a tried-and-tested regular expression that would only split on commas not in quotes?

Any suggestions gratefully received.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:21:58+00:00Added an answer on May 11, 2026 at 10:21 am

    VBScript does not have a module system comparable to Perl. However you can open CSV files with ADO and access them like a database table. The code would go something like this:

    (The funny comments are solely to fix SO’s broken VB syntax highlighting)

    Dim conn    ''// As ADODB.Connection Dim rs      ''// As ADODB.RecordSet Dim connStr ''// As String Dim dataDir ''// As String  dataDir = 'C:\'                         '' connStr = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' & dataDir & ';Extended Properties=''text'''  Set conn = CreateObject('ADODB.Connection') conn.Open(connStr) Set rs = conn.Execute('SELECT * FROM [data.txt]')  ''// do something with the recordset WScript.Echo rs.Fields.Count & ' columns found.' WScript.Echo '---'  WScript.Echo rs.Fields('Col1Name').Value If Not rs.EOF Then   rs.MoveNext   WScript.Echo rs.Fields('Col3Name').Value End If  ''// explicitly closing stuff is somewhat optional ''// in this script, but consider it a good habit rs.Close conn.Close  Set rs = Nothing Set conn = Nothing 

    Creating a schema.ini file that exactly describes your input is optimal. If you don’t, you force the text driver to guess, and all bets are off if it guesses the wrong thing. The schema.ini must reside in the same directory where your data is.

    Mine looked like this:

    [data.txt] Format=Delimited(;) DecimalSymbol=. ColNameHeader=True MaxScanRows=0 Col1=Col1Name Long Col2=Col2Name Long Col3=Col3Name Text Col4=Col4Name Text 

    and with this data.txt:

    a;b;c;d 1;2;'foo bar';'yadayada' 1;2;'sample data';'blah' 

    I get this output:

    C:\>cscript -nologo data.vbs 4 columns found. --- 1 sample data  C:\> 

    Worth a read in this regard: Much ADO About Text Files off the MSDN.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the need to read the Thunderbird address book on the fly. It
I need to have a script read the files coming in and check information
I have a need to use extensionless URLs. I do not have access to
We have need for a rating system in a project we are working on,
I have need to select a number of 'master' rows from a table, also
I have a need to display a UITableView containing a user's account credentials. For
I have a need to create a transactional process using an external API that
I have a need to close a parent form from within child form from
I have a need to do auditing all database activity regardless of whether it
I have the need to copy the entire contents of a directory on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.