''' Demo update sheet content Created on 2018年3月18日 @author: Rocky ''' from googlesheet02.googlesheetService import GooglesheetService googlesheetService = GooglesheetService( "1CxCM_fOzFAySeg7pDs5g0SPCHOkxJFGQaisru3iC6Lw" ) # init service by spreadsheetId rangeName = "工作表七" # ensure you have a sheet named it row1 = ["stockd", "price", "amount"] row2 = ["0050", 80.70, 2500] row3 = ["2317", 90.70, 8500] rowList = [row1, row2, row3] googlesheetService.appendSheet(rangeName, rowList)
''' Demo clear sheet content and update again fomat clear will not be clear, example, if you set center of cell Created on 2018年3月18日 @author: Rocky ''' from googlesheet02.googlesheetService import GooglesheetService import time googlesheetService = GooglesheetService( "1CxCM_fOzFAySeg7pDs5g0SPCHOkxJFGQaisru3iC6Lw" ) # init service by spreadsheetId rangeName = "工作表七" # ensure you have a sheet named it rowList = googlesheetService.getValues(rangeName) for row in rowList: print(row)
''' 檢查粉絲頁列表,建立尚未建立的 sheet Created on 2018年3月19日 @author: rocky.wang ''' from googlesheet02.googlesheetService import GooglesheetService import requests import json # always effective token = "EAABb6vxMesIBAISKgjO7L9kVIqESpB5B4ZCIKdlz7DBSSit2E09FkL9NIf6bUx5GsO7tXDFobtC4YfZAZCNldDZANJ7SsEPFEClEB5RlEie7hvvLymjVgzxXgwqbx7MZBfNZCeycTTK0zZB6sWMrbtIx0IQPbevQhAI6Y0c1xorqgZDZD" googlesheetService = GooglesheetService("1bydUUYVTxyyz2jxm3JRzIQkdElNthLHuQpzW6-DLVUk") # init service by spreadsheetId def main(): rowList = googlesheetService.getValues("粉絲頁列表") checkTab(rowList) googlesheetService.updateSheet("粉絲頁列表", rowList) def checkTab(rowList): for row in rowList: if len(row) > 1: continue print(row[0])
''' Created on 2018年3月18日 @author: Rocky ''' from googlesheet02.googlesheetService import GooglesheetService spreadsheetId = "1CxCM_fOzFAySeg7pDs5g0SPCHOkxJFGQaisru3iC6Lw" googlesheetService = GooglesheetService( spreadsheetId) # init service by spreadsheetId title = "工作表七" sheetId = googlesheetService.addSheet(title) print(sheetId)
''' fetch fanPageData on google sheet and notify Created on 2018年3月19日 @author: rocky.wang ''' from googlesheet02.googlesheetService import GooglesheetService import lineTool import os sheetService = GooglesheetService( "1bydUUYVTxyyz2jxm3JRzIQkdElNthLHuQpzW6-DLVUk") def main(): rangeName = "華倫存股 穩中求勝" rowList = sheetService.getValues(rangeName) # filter not notify topics notifyRowList = [row for row in rowList if row[3] != "OK"] rowListToMessage(notifyRowList, rangeName) # update notify status for row in rowList: row[3] = "OK" rowList = sheetService.updateSheet(rangeName, rowList)