Showing posts with label CSV. Show all posts
Showing posts with label CSV. Show all posts

Wednesday, January 11, 2006

[VBScript] CSV to variables using Execute

Nico wrote, on microsoft.public.scripting.vbscript:
I need ASP to read the CSV file to read lines 2 on-wards and display it back to the user for verification. Each line has aprx 8 "," that control user properties.

I am looking for each line to be displayed back to the user without the "," so they can verify and write to an access db.

All i am looking for is a simple way to read the text display to the user for acceptance before writing it back to the db.
I wrote a response but thought a fuller treatment was in order, thus the following:

Data, stored in DEMO.CSV
Then the code which does nothing other than read the file, store the data in variables for each line of data, and for effect, echoes the first and last names And here's the results of the run, taken from SciTE's output window A possible extra step would be to read the header line, strips the spaces, build the "Dim" statements and execute them as well. Or maybe, create an instance of "Scripting.Dictionary" and use that. Or ... well, there must be more than two ways to do it, even in VBScript!