![]() |
Importing Data
Hello,
I have some data in a text file that I would like to import. Unfortunately, it's not in CSV format. I was wondering if it's possible in VBA to open this file, read in a line, and parse the line as I need, and then write the line (cells) to a spreadsheet. Or should I just write a file pre-processor (which generates a CSV file) in Java, C, whatever, and import the data. I'm not a VBA expert, so I don't know the limitations. Any help would be appreciated. Regards, Alan |
Importing Data
Yes it can be done.
Don't know your level of Basic knowledge nor what the records look like however. i.e are the records comprised of fixed length fields? If so the Text Import Wizard will allow you to parse the records without having to resort to VBA, select "Fixed Width", 2nd dialogue allows you to parse the record. If not fixed length fields and the fields have delimiters then select "Delimited", the second dialogue allows you to specify what the delimiters are. HTH -- Regards; Rob ------------------------------------------------------------------------ "Alan L. Wagoner" wrote in message ... Hello, I have some data in a text file that I would like to import. Unfortunately, it's not in CSV format. I was wondering if it's possible in VBA to open this file, read in a line, and parse the line as I need, and then write the line (cells) to a spreadsheet. Or should I just write a file pre-processor (which generates a CSV file) in Java, C, whatever, and import the data. I'm not a VBA expert, so I don't know the limitations. Any help would be appreciated. Regards, Alan |
Importing Data
Rob,
My level of VBA knowledge is not that great. The file in question is generally tab delimited, but the reason I can't use the wizard is that the raw file has page number/date/time header stuff which I don't want. I'm trying to make this spreadsheet as idiot-proof as possible. Ideally, the VBA would ask the user, "Where is the file?", and they could locate it, it would get parsed, brought into Excel, and then the user could just look at the numbers. I'll have to mess with this a bit to see if it will work. Thanks for the assistance. --Alan "RWN" wrote in message ... Yes it can be done. Don't know your level of Basic knowledge nor what the records look like however. i.e are the records comprised of fixed length fields? If so the Text Import Wizard will allow you to parse the records without having to resort to VBA, select "Fixed Width", 2nd dialogue allows you to parse the record. If not fixed length fields and the fields have delimiters then select "Delimited", the second dialogue allows you to specify what the delimiters are. HTH -- Regards; Rob |
All times are GMT +1. The time now is 07:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com