you could have your def notepad accept a list data type parameter, and the iterate through the list (dataList) and write the information to file. you would basically call the notepad def in the excel def.
baki100
Junior Poster in Training
79 posts since Apr 2009
Reputation Points: 12
Solved Threads: 14
def notepad(dataList):
text_file = open("write.txt","w")
for item in dataList:
#write the data however you want
text_file.write('%s\n'%item)
text_file.close()
def excel():
from win32com.client import Dispatch
xlApp = Dispatch ("Excel.Application") #Calls for Excel
xlWb = xlApp.Workbooks.Open('IT.xls') #It finds the workbook
xlSht = xlWb.Worksheets (1) Goes to sheet 1
dataList = []
for row in range (1,198): #It goes through the 198 items in A and B
for col in (1,2):
dataList.append(xlSht.Cells(row,col))
notepad(dataList)
baki100
Junior Poster in Training
79 posts since Apr 2009
Reputation Points: 12
Solved Threads: 14