我可以用程式碼抓取雲端上Excel一格一格的資料
是list的型態
但是有辦法把檔案轉成json檔嗎?
python的版本是2.7.13
import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
#googlo drive api認證
json_key = json.load(open('project-key.json')) downloaded earlier
scope = ['https://spreadsheets.google.com/feeds']
credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'].encode(), scope)
file = gspread.authorize(credentials)
#打開google drive excel 文件
sheet = file.open("test.xlsx").sheet1
all_cells = sheet.range('A1:C6')
輸出是list的型態
[<Cell R1C1 u'\u7533\u8acb\u65e5\u671f'>, <Cell R1C2 u'\u7533\u8acb\u4eba'>, <Cell R1C3 u'\u4f7f\u7528\u5ba2\u6236\u540d\u7a31'>, <Cell R2C1 '8/1/2017'>, <Cell R2C2 'C'>, <Cell R2C3 ''>, <Cell R3C1 '8/2/2017'>, <Cell R3C2 'C'>, <Cell R3C3 ''>, <Cell R4C1 '8/3/2017'>, <Cell R4C2 'C'>, <Cell R4C3 ''>, <Cell R5C1 '8/4/2017'>, <Cell R5C2 'C'>, <Cell R5C3 ''>, <Cell R6C1 '8/5/2017'>, <Cell R6C2 'C'>, <Cell R6C3 ''>]
還是只能載下來後再轉json檔...