Automated conversion from TXT

keithversi

New Member
Joined
Nov 12, 2019
Messages
4
I have a txt file that needs to be converted from txt to csv with excel. Process needs to be automated and I am not sure how to do this at all.
Any input would be a big help. The deliminator is a |
Thanks
Keith
 

sandy666

Well-known Member
Joined
Oct 24, 2015
Messages
3,228
did you try change .txt to .csv ? (try on copy)
 
Last edited:

keithversi

New Member
Joined
Nov 12, 2019
Messages
4
yes and it will not work, this is the info wish I could upload the file its self


Company: VersiPOS Master Demo Menu
Run Time: 11/12/19 02:10PM
Reporting On: 11/03/2019
-------------------------------------------------------------------------


REPORT GROUP: csv
--------------------------------

REPORT PRESET: csv export


SALES BY HEADING:

Heading Qty TotSales NetSales Taxable Accntable %
--------------|------|---------|---------|---------|---------|-----
ALCOHOL | 143| 823.60| 769.49| 735.04| 839.32|29.04
FOOD | 58| 306.85| 297.32| 297.32| 325.56|10.82
MERCHANDISE | 120| 834.60| 761.06| 761.06| 833.36|29.43
MISC. | 17| 110.15| 66.20| 66.20| 72.49| 3.88
N/A BEV | 60| 189.00| 184.05| 184.05| 201.53| 6.66
PAIDOUT | 1| 6.95| 6.95| 6.95| 7.61| 0.25
<#33> | 3| 28.50| 28.50| 28.50| 31.21| 1.01
<#38> | 10| 48.65| 48.65| 48.65| 53.27| 1.72
<#40> | 6| 35.70| 35.70| 35.70| 39.09| 1.26
<#41> | 60| 451.80| 451.80| 451.80| 494.72|15.93
--------------|------|---------|---------|---------|---------|-----
| 478| 2835.80| 2649.72| 2615.27| 2898.15|


SALES BY DEPT:

Department Qty TotSales NetSales Taxable Accntable %
--------------|------|---------|---------|---------|---------|-----
<#33> | 3| 28.50| 28.50| 28.50| 31.21| 1.01
<#38> | 10| 48.65| 48.65| 48.65| 53.27| 1.72
<#40> | 6| 35.70| 35.70| 35.70| 39.09| 1.26
<#41> | 60| 451.80| 451.80| 451.80| 494.72|15.93
)Mary Mods | 6| 19.70| 19.70| 19.70| 21.57| 0.69
*Entrees | 2| 11.90| 11.90| 11.90| 13.03| 0.42
*Pizza | 1| 36.00| 36.00| 36.00| 39.42| 1.27
*Soup/Salad | 41| 161.40| 152.76| 152.76| 167.27| 5.69
/Ready At | 16| 108.65| 64.70| 64.70| 70.85| 3.83
>Drfat Pitcher| 3| 12.85| 12.11| 12.11| 13.26| 0.45
>Growler Fill | 34| 250.25| 228.08| 228.08| 249.75| 8.82
>Liquor | 9| 26.45| 26.45| 26.45| 28.96| 0.93
>Mixed Drinks | 1| 14.95| 14.95| 0.00| 14.95| 0.53
>N/A Bev | 60| 189.00| 184.05| 184.05| 201.53| 6.66
>Well | 1| 15.50| 15.50| 15.50| 16.97| 0.55
>Wine | 66| 423.60| 392.40| 392.40| 429.68|14.94
@Plates | 14| 97.55| 96.66| 96.66| 105.84| 3.44
ALCOHOL | 23| 60.30| 60.30| 40.80| 64.18| 2.13
MERCHANDISE | 120| 834.60| 761.06| 761.06| 833.36|29.43
_Misc. | 1| 1.50| 1.50| 1.50| 1.64| 0.05
_Paidout | 1| 6.95| 6.95| 6.95| 7.61| 0.25
--------------|------|---------|---------|---------|---------|-----
| 478| 2835.80| 2649.72| 2615.27| 2898.16|


PAYMENT TOTALS:

Qty | | Payment | Amount
-----|-----------|------------|---------
2| |** CHOW NOW | 104.79
12| |** POSTMATES| 339.01
76| |CASH | 2670.92
4| |CASH | 73.01
-----|-----------|------------|---------
| | Received| 3187.73
| | Tips|- 244.05
| |------------|---------
| | Collected| 2943.68

Qty | | Card Types | Amount
-----|-----------|------------|---------
18| |AMEX | 1072.36
45| |VISA | 1266.21
13| |MC | 332.35
-----|-----------|------------|---------
76| | Received| 2670.92
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
7,753
Office Version
2007
Platform
Windows
Hi @, welcome to the forum!

Check if the following is what you need, change "myfile" to the name of your file.


Put the txt file in the same excel folder with the macro.


Code:
Sub Macro5()
  Dim wPath As String, wFile As String
  Application.ScreenUpdating = False
  Application.DisplayAlerts = False
  wPath = ThisWorkbook.Path & "\"
  wFile = "[COLOR=#ff0000]myfile[/COLOR]"
  Workbooks.OpenText Filename:=wPath & wFile & ".txt", Origin:=xlMSDOS, _
    StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlNone, _
    ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:=False, _
    Space:=False, Other:=True, OtherChar:="|", FieldInfo:=Array(Array(1, 1)), _
    TrailingMinusNumbers:=True
  ActiveWorkbook.SaveAs Filename:=wPath & wFile & ".csv", _
    FileFormat:=xlCSV, CreateBackup:=False
  ActiveWorkbook.Close False
End Sub
 

keithversi

New Member
Joined
Nov 12, 2019
Messages
4
Hi @, welcome to the forum!

Check if the following is what you need, change "myfile" to the name of your file.


Put the txt file in the same excel folder with the macro.


Code:
Sub Macro5()
  Dim wPath As String, wFile As String
  Application.ScreenUpdating = False
  Application.DisplayAlerts = False
  wPath = ThisWorkbook.Path & "\"
  wFile = "[COLOR=#ff0000]myfile[/COLOR]"
  Workbooks.OpenText Filename:=wPath & wFile & ".txt", Origin:=xlMSDOS, _
    StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlNone, _
    ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:=False, _
    Space:=False, Other:=True, OtherChar:="|", FieldInfo:=Array(Array(1, 1)), _
    TrailingMinusNumbers:=True
  ActiveWorkbook.SaveAs Filename:=wPath & wFile & ".csv", _
    FileFormat:=xlCSV, CreateBackup:=False
  ActiveWorkbook.Close False
End Sub

the same folder where the macro is stored?
 

keithversi

New Member
Joined
Nov 12, 2019
Messages
4
ok that is not what I was hoping for :(
is there a script I can use to convert this over ??
I have two issues with it the | is one deliminator and the headers don't have the | which I will be needing.

Thanks
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
7,753
Office Version
2007
Platform
Windows
What did you expect?
You can upload 2 files to the cloud, a txt file with the original data and a csv file with the result of the first file conversion.

You could upload a copy of your file to a free site such www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.
 

Forum statistics

Threads
1,077,828
Messages
5,336,622
Members
399,093
Latest member
chado4250

Some videos you may like

This Week's Hot Topics

Top