I would like to programmatically add a header to an already existing CSV file using Python. The problem is that I do not want to overwrite the first row of the file, I would like to push all data downwards by one row and add the header on the first row without overwriting anything. Can this be done? Thanks in advance.
1 Answer
Is not possible to add data at the beginning of a file, you can only replace content or add data at the end of a file.
The solution would be to write a new file with your header and all the content of your original file.
1 Comment
Luke Xuereb
is it possible to merge 2 csv files, one with the headers and the other with the data?