Related Posts
San Antonio food and things to do???
I’m a simple guy. I see Mc🐝. I upvote.
Additional Posts in Excel Genius
How useful are Macros and VBAs for tax prep?
Would anyone be willing to teach me vlookup?
What is the best online tool to pick up VBA?
PowerQuery > PowerBI .. thoughts ?
Why don't recent grads know how to use excel?
New to Fishbowl?
unlock all discussions on Fishbowl.







DAT files are generic data exports from an application, which often do not follow a specific standard. Thus, formatting of DAT files are inconsistent. Your best bet is to open the file in a text editor and see how it's formatted (e.g., comma delimited, tab delimited, pipe delimited, etc.) If it looks like a bunch of nonsense (i.e., random characters), it may be compressed, in a proprietary format (like a vendor-specific backup format), or some other issue. If the latter, you'll need to talk to who provided it to understand how to access the data.
If it is in a delimited format, you can use almost any programming language to parse it. Trivial to do if you already know how to program. I would recommend Python or Ruby for something like this. Another option - push the work back to the client. Make them give it to you in a ready-to-use format.
Scripting references - follow documentation to use the correct delimiter for your file.
https://docs.python.org/3/library/csv.html
https://ruby-doc.org/stdlib-3.0.1/libdoc/csv/rdoc/CSV.html
Thank you so much! They are in delimited format so I think I will look into some beginner Python courses to do that, or Macro. Let me check out the links you provided first. :)
Pretty sure you can do this with Python, but depending on how many files you have, whether this is a repeatable task in the future, and whether or not you already have python set up, brute force manual conversions may be easier
Thank you! I don't know how to use Python, but the work will be repetitive each month in the future. Delimited will be using comma. Where would you suggest me to start?
I’ve done it with an excel macro. You can even set it up as a Personal Macro and a certain key combination so when you open the DAT file in excel and hit the key combination it kicks off the macro on the active worksheet
I'd add, to that macro the DIR() function will store the first file in a folder and calling again moves to the next, repeat infinite. Loop [MyFile= DIR(), open( MyFile), convert(MyFile), close(MyFile) save=false, next ] exit loop if myfile is null as end of list
Several lines of vba code can do this
https://stackoverflow.com/questions/22616886/using-vba-to-open-a-tab-delimited-txt-file-to-save-to-xlsx-format