#!/usr/bin/python
# -*- coding:utf-8 -*-
import sys
import time
import gdata.spreadsheet
import gdata.spreadsheet.service
import gdata.spreadsheets.data
def _CellsUpdateAction(row,col,inputValue,key,wksht_id):
entry = spr_client.UpdateCell(row=row, col=col, inputValue=inputValue,
key=key, wksht_id=wksht_id)
#if isinstance(entry, gdata.spreadsheet.SpreadsheetsCell):
#print 'Updated!'
email = '이메일'
password = '패스워드'
weight = '180'
# Find this value in the url with 'key=XXX' and copy XXX below
spreadsheet_key = '키번호'
# All spreadsheets have worksheets. I think worksheet #1 by default always
# has a value of worksheet_id 는 gid값 하고 관련이 없어 보인다, 암튼, 기본은 od6인데, od4, od8 로 임의 입력하며 원하는 시트를 찾아서 입력한다.
worksheet_id = 'od6'
spr_client = gdata.spreadsheet.service.SpreadsheetsService()
spr_client.email = email
spr_client.password = password
spr_client.source = 'Example Spreadsheet Writing Application'
spr_client.ProgrammaticLogin()
# Prepare the dictionary to write
#dict = {}
#dict['date'] = time.strftime('%m/%d/%Y')
#dict['time'] = time.strftime('%H:%M:%S')
#dict['weight'] = weight
#uu = u'비고'
no = int(sys.argv[1])
keyword = unicode(sys.argv[2],'utf-8')
fr = unicode(sys.argv[3],'utf-8')
comment = unicode(sys.argv[4],'utf-8')
freq = sys.argv[5]#if type is integer, do not int() function
recommend = unicode(sys.argv[6],'utf-8')
use = sys.argv[7]#if type is integer, do not int() function
reguser = unicode(sys.argv[8],'utf-8')
regip = unicode(sys.argv[9],'utf-8')
regdate = unicode(sys.argv[10],'utf-8')
#print sys.argv[3]
i = no + 6
#_CellsUpdateAction(i,2,'1',spreadsheet_key,worksheet_id)
_CellsUpdateAction(i,3,keyword,spreadsheet_key,worksheet_id)
_CellsUpdateAction(i,4,fr,spreadsheet_key,worksheet_id)
_CellsUpdateAction(i,5,comment,spreadsheet_key,worksheet_id)
_CellsUpdateAction(i,6,freq,spreadsheet_key,worksheet_id)
_CellsUpdateAction(i,7,recommend,spreadsheet_key,worksheet_id)
_CellsUpdateAction(i,8,use,spreadsheet_key,worksheet_id)
_CellsUpdateAction(i,9,reguser,spreadsheet_key,worksheet_id)
_CellsUpdateAction(i,10,regip,spreadsheet_key,worksheet_id)
_CellsUpdateAction(i,11,regdate,spreadsheet_key,worksheet_id)
print 1
#entry = spr_client.InsertRow(dict, spreadsheet_key, worksheet_id)
#if isinstance(entry, gdata.spreadsheet.SpreadsheetsList):
# print "Insert row succeeded."
#else:
# print "update row failed."
#feed = spr_client.GetSpreadsheetsFeed()
댓글 달기