Q:

Writing large data to a excel column cell with looping

Parsing .ts file and getting string from that file. i want write that string to excel column. can anyone help me?
from xml.dom import minidom
import sys, xlsxwriter
import pandas as pd
import numpy as np

reload(sys)
sys.setdefaultencoding('utf-8')
doc = minidom.parse("english.ts")

def main():
    writer = pd.ExcelWriter('new.xlsx', engine='xlsxwriter')
    messages = doc.getElementsByTagName("message")
    for message in messages:
        source = message.getElementsByTagName("source")[0]
        ori_string = source.firstChild.data
        print ori_string
        df = pd.DataFrame({'TString': [ori_string]})
        writer = pd.ExcelWriter('new.xlsx', engine='xlsxwriter')
        df.to_excel(writer, sheet_name='Sheet1')
        writer.save()

if __name__ == '__main__':
    main()

I am not getting error and "ori_string" is printing but in excel sheet nothing is written.
I want to just write the string to the excel column.how to iterate  rows and how to give row and column number inside iteration?  

A:

from xml.dom import minidom
import sys, xlsxwriter

reload(sys)
sys.setdefaultencoding('utf-8')
doc = minidom.parse("english.ts")

def main():
    row = 0
    messages = doc.getElementsByTagName("message")
    workbook = xlsxwriter.Workbook('data3.xlsx')
    worksheet = workbook.add_worksheet()
    for message in messages:
        source = message.getElementsByTagName("source")[0]
        ori_string = source.firstChild.data
        print ori_string
        worksheet.write(row, 0, ori_string)
        row += 1    
    workbook.close()

Now its working thank you @DavidG for your suggestion.

