Fix a small python script (csv, googletrans API)

Job ID: 36229244

Budget: €8 – €30 EUR

I made a small script that reads a csv, and should translate every cell from columns I to T from english to german using the googletrans API. unfortunately my code below does not work:

import csv
from googletrans import Translator

# open the CSV file
with open('german.csv', 'r') as csv_file:
csv_reader = csv.reader(csv_file)

# initialise translator
translator = Translator()

# loop through each row of the csv
for row in csv_reader:

# loop through each column I to T
for i in range(8, 20):
# translate the content in each column
translation = translator.translate(row[i], dest='de')

# update the content in the row with the translated text
row[i] = translation.text

# write the translated text to a new csv file
with open('germanFinal.csv', 'w') as new_file:
writer = csv.writer(new_file)
writer.writerow(row)