Reputation: 83
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.
Upvotes: 0
Views: 162
Reputation: 320
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.
Upvotes: 1