0
我想發送電子郵件地址存放在谷歌電子表格中的郵件。我能夠得到單元格的值,但我得到:使用gspread獲取逗號分隔的單元格值列表
(<Cell R1C1 '[email protected]'>,)
(<Cell R2C1 '[email protected]'>,)
...
爲了使用MimeMultipart的,我需要逗號分開: 電子郵件@ gmail.com,email1gmail.com,.. 。
這是我的代碼:
import gspread
import json
from oauth2client.client import SignedJwtAssertionCredentials
import gdata.spreadsheet.service
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import smtplib
json_key = json.load(open('xxx.json'))
scope = ['https://spreadsheets.google.com/feeds']
credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], scope)
gc = gspread.authorize(credentials)
wks = gc.open('xxx')
worksheet_id = 'od6'
worksheet = wks.get_worksheet(0)
print worksheet.row_values("A1")
for x in xrange(1,50):
test = "A%s" %x
msg = MIMEMultipart()
msg["To"] = worksheet.acell(test),
print msg["To"]