Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



New data to the first line in *.csv file via VB Script

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 19-04-2012
Member
 
Join Date: Apr 2012
Location: Europe
Posts: 7
New data to the first line in *.csv file via VB Script
  

Hello.

Welcome every one.
I have some data in CSV

I need to open this CSV file via VBS script and add some data in the end of first line and save this file. For example

aaa;bbb;ccc
111;111;111
222;222;222

should be:

aaa;bbb;ccc;ddd;eee;fff
111;111;111
222;222;222


Hot to do it with VBS ?

Best Regards
C

Reply With Quote
  #2  
Old 11-06-2012
Member
 
Join Date: Jan 2006
Posts: 605
Re: New data to the first line in *.csv file via VB Script

Can you try the below code and see if that will work:

Code:
Set outputFile = fso.OpenTextFile(File1, ForWriting, True)
 Set inputFile = fso.OpenTextFile(File2, ForReading)
 Do While inputFile.AtEndOfStream <> True
     arr = Split(inputFile.ReadLine, ",")
     arr(3) = "E"
     outputString = Join(arr, ",")
     outputFile.WriteLine outputString
 Loop
Reply With Quote
  #3  
Old 12-06-2012
Member
 
Join Date: Apr 2012
Location: Europe
Posts: 7
Re: New data to the first line in *.csv file via VB Script

Quote:
Originally Posted by janos™ View Post
Can you try the below code and see if that will work:

Code:
Set outputFile = fso.OpenTextFile(File1, ForWriting, True)
 Set inputFile = fso.OpenTextFile(File2, ForReading)
 Do While inputFile.AtEndOfStream <> True
     arr = Split(inputFile.ReadLine, ",")
     arr(3) = "E"
     outputString = Join(arr, ",")
     outputFile.WriteLine outputString
 Loop
Thank you.
I'll check this.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "New data to the first line in *.csv file via VB Script"
Thread Thread Starter Forum Replies Last Post
script to extract data from text file and put into excel format tdubb Windows Server Help 19 17-11-2010 03:19 PM
Can't convert documents in Php script (via command line) eawade Windows Software 2 20-01-2010 05:34 AM
How to let Java read text file line by line. Visala28 Software Development 3 04-08-2009 11:30 PM
Script to insert new line in a file in linux OSzilla Operating Systems 3 28-07-2009 11:48 PM
Bash Script, read without new line Kieran Software Development 2 06-02-2009 08:59 PM


All times are GMT +5.5. The time now is 11:51 AM.