Adding a header to a CSV file

T

Tom Cameron

Hi,

I have a number of CSV files I wish to query using ADO, the only
problem is there are no headers in the CSV files. The obvious option is
to open them in excel and manually enter the headers, howerver there
are more than 65536 records so this is not possible.

Does anyone have any good ideas? any help would be much appreciated.

Thanks,
Tom
 
N

NickHK

If it only a few files that you need to change, NotePad/WordPad can open
these
Otherwise, you can import them into Access. Number of rows is not a concern
then.
Make you changes then export, if you need to keep the .csv format.

NickHK
 
T

Tim Williams

If you know what the headers should be then you could just construct your SQL using the default field names provided by ADO and
alias the names to the "correct" values...

Tim
 
D

Dave Peterson

Do they all use the same layout?

If yes, create a file with that single header line.

Then shell to DOS and merge the files using an old DOS command.

Go to the folder that contains the .CSV files and header file and issue this
command:

copy Header.txt + somefile.csv somefileNEW.csv
 
T

Tom Cameron

Thanks for you help everyone, I've used the default ADO headers to get
this to work.

Cheers,
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top