0

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.

0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

is it possible to merge 2 csv files, one with the headers and the other with the data?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.