gspread公司
. 我找不到适用于它的函数的文档
docs.gspread.org
. 如下面的代码片段所示,我当前正在使用该命令
worksheet.append_row(['testpic.png', '=IMAGE(\"{}\")'.format(
'https://raw.githubusercontent.com/eliasdon/picturetest/main/download.png')], value_input_option='USER_ENTERED')
但是附加的图片非常小,即使手动调整也无法调整大小,如所附图片所示
我在谷歌表单上找到了这本指南
worksheet.append_row(['IMAGE("https://www.google.com/images/srpr/logo3w.png", 4, 50, 100)'], value_input_option='USER_ENTERED')
worksheet.append_row(['IMAGE("https://www.google.com/images/srpr/logo3w.png", 4, 50, 100)'])
代码:
import gspread
from oauth2client.service_account import ServiceAccountCredentials
# google scope
scope = ["https://spreadsheets.google.com/feeds", 'https://www.googleapis.com/auth/spreadsheets',
"https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive"]
# read credentials from json
creds = ServiceAccountCredentials.from_json_keyfile_name("creds.json", scope)
# get access using creds
client = gspread.authorize(creds)
# open sheet
sheet = client.open("test")
# open worksheet witin sheet
worksheet = sheet.worksheet('check')
# append pic
worksheet.append_row(['testpic.png', '=IMAGE(\"{}\")'.format(
'https://raw.githubusercontent.com/eliasdon/picturetest/main/download.png')], value_input_option='USER_ENTERED')
如何将图片发送到google sheets并使其缩放到原始大小或设置的尺寸(x,y)?