I have a text file in this format :
{
attribute1 attribute2 attribute3.... attributeN
value\"A\" value\"B\" value\"C\".... value\"Z\"
/* next line of val
Here's some Excel-VBA code that will do this conversion. Paste this in Excel's visual basic editor (Alt-F11
) and run it (after adjusting your filenames, of course).
Sub TabToCsv()
Const ForReading = 1, ForWriting = 2
Dim fso, MyTabFile, MyCsvFile, FileName
Dim strFileContent as String
Set fso = CreateObject("Scripting.FileSystemObject")
' Open the file for input.
Set MyTabFile = fso.OpenTextFile("c:\testfile.dat", ForReading)
' Read the entire file and close.
strFileContent = MyTabFile.ReadAll
MyTabFile.Close
' Replace tabs with commas.
strFileContent = Replace(expression:=strFileContent, _
Find:=vbTab, Replace:=",")
' Can use Chr(9) instead of vbTab.
' Open a new file for output, write everything, and close.
Set MyCsvFile = fso.OpenTextFile("c:\testfile.csv", ForWriting, True)
MyCsvFile.Write strFileContent
MyCsvFile.Close
End Sub