Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

modify records in a csv file

Status
Not open for further replies.

GJP55

Technical User
Feb 2, 2003
220
GB
Is there an effective method for reading a large (90000+ records) csv file and then modifying the values (replacing certain characters) and closing the file ?

 
If you are doing a straight character replace, then it might work to slurp the whole thing up into a string var then just use Replace().

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Yes, thats what I want to do but is there a limit on the size of the string ? 90000 rows times approx 200 characters.
 
You're not even close to the size limit of a string variable.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
plus you could have written code to test if it is past the limit in the time it took to post this question and wait for answers.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
maybe if I knew what to write. Im not very VB literate.
Based on it just being a straight forward replace, what is the best method to use ?
 
Replace()

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thanks for your reply, I was thinking more along the lines of what method to use to open the file, update & save.

Thanks
 
Aaah. For that you use the ForumSearch() method or even the FAQ() method since it has been covered several times.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 

Tip: Scripting.FileSystemObject + TextStream or the good old days OPEN statement

Help files are also very helpfull on this, if you have them installed.
 
I prefer to use the Scripting component personally. It's more consistent with OO coding syntax.

And just in case it wasn't clear, EBGreen is being facetious about the existence of either a ForumSearch or an FAQ method. :)

Bob
 
Who me? Facetious? Perish the thought!

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Yeah, I had visions of the OP doing searches for these methods and coming up empty handed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top