# Extract email addresses from column H of Excel spreadsheet # named Directory.xls creating a text file "Email.txt" that # contains only the email addresses from the spreadsheet. # The script also writes the name of the worksheet and the # number of rows in the worksheet to the terminal window. from xlrd import open_workbook,cellname book = open_workbook('Directory.xls') email_file = open('Email.txt', 'w') sheet = book.sheet_by_index(0) print "Worksheet name: ",sheet.name print "Number of entries: ",sheet.nrows # Email addresses are in the 8th column, column H, but 1st column is column 0 col_index = 7 for row_index in range(sheet.nrows): email_file.write(sheet.cell(row_index,col_index).value + "\n") email_file.close()