Skip to content Skip to sidebar Skip to footer

Adding Carriage Return To Every Line In A Csv File Stored In A Gcs Bucket

I have a requirement to add carriage return at the end of each line in a CSV file that is available in a GCS bucket. I want to store the modified data in a new file in same GCS buc

Solution 1:

Firstly, your code is wrong. You can't write line by line. If you do that, the new write override the previous one and thus, at the end, you will store only the lastest line.

Instead, create a buffer of your transformed file and write it after your FOR loop (not inside).

Then, It's not normal that you override the original file. Are you sure? The destination blob is clearly different, and you can't override existing data like that.

Post a Comment for "Adding Carriage Return To Every Line In A Csv File Stored In A Gcs Bucket"