Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

BAT file that convert .txt to a CSV in excel


  • Please log in to reply
4 replies to this topic

#1 SammiD

SammiD

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:03:00 PM

Posted 06 May 2015 - 10:31 AM

I'm trying to write a BAT file to convert saved data in a .txt file to a CSV in excel. I want it separated by commas into cells. Below is an example of what the data looks like

 

4,2468,Large Box Truck,12 ,,,,2015,4,10,16,32,3,33,
5,2468,Large Box Truck,123456 ,,,,2015,4,14,16,52,2,19,
6,2468,Tractor Only,652 ,,,,2015,4,14,17,36,3,35,
7,2468,Tractor Only,523 ,,,,2015,4,14,17,44,0,38,
8,2468,Car-Van-Pickup,24 ,,,,2015,4,14,17,53,2,51,
9,2468,Small Box Truck,35 ,,,,2015,4,14,18,13,2,8,
 


BC AdBot (Login to Remove)

 


#2 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:12:00 PM

Posted 06 May 2015 - 10:34 AM

Excel opens CSV natively; there's no conversion necessary.

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

#3 Sirawit

Sirawit

    Bleepin' Brony


  • Malware Response Team
  • 4,161 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Thailand
  • Local time:02:00 AM

Posted 06 May 2015 - 10:39 AM

Does your data already contains comma-separators? If yes it should be able to load into excel directly.

 

Thank you.


If I don't reply back to you in 2 days, feel free to send me a PM.

 

“You’re lying… just like you were lying to me before. You have to hate me. I’ve been the worst daughter in the world… you should hate me.”

“But I don’t, Nyx. Because, Nyx, I’m your mother, and a mother will always love her daughter, no matter what.” -Past sins by Pen stroke.


#4 SammiD

SammiD
  • Topic Starter

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:03:00 PM

Posted 06 May 2015 - 10:48 AM

yes it does, but it's saved as a txt file... instead of me opening 50 files, then copy and past it into excel, and then using the "Text to Columns option; i want it done a quicker way



#5 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:05:00 AM

Posted 06 May 2015 - 06:33 PM

yes it does, but it's saved as a txt file... instead of me opening 50 files, then copy and past it into excel, and then using the "Text to Columns option; i want it done a quicker way

 

 

Then just rename the file from Textfile.txt to Textfile.csv, or right click the csv file and change it to open to excell if you have accidently changed csv files to open in notepad.


Edited by JohnnyJammer, 06 May 2015 - 06:34 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users