我确信这里的建议是使用S3存储桶,我知道这一点。从我收集的信息来看,我的问题有点困难,因为我想使用Pygsheets,一个python库,来写入Google Sheet。但是,在完成所有部署和层步骤之后...让我停下来的是一个烦人的.json文件,它需要由Pygsheets中的一个函数读取。我确实相信它是在飞快地读和写其他东西,这些东西本身可能是不允许的,但我不管怎样都在问。
直接从Google链接到需要与secret.json一起使用的函数:Pygsheets Github
示例代码:
print("-->Using the library pygsheets to update...")
print(f"-->Accessing client_secret.json")
gc = pygsheets.authorize(service_file='client_secret.json')
print(f"-->Opening Google Sheets")
#open the google spreadsheet
sh = gc.open_by_url('https://...')
print(f"-->Accessing")
#select the first sheet
wks = sh[0]
print(f"-->Updating selected cells... ")
#update the first sheet with df, starting at cell A11.
wks.set_dataframe(df, 'J14')同样,我即将使用这个脚本/库/lambda自动化我的工作表,我可以尝试它:)。如果绝对最好的变通方法是S3,请温和一点,我是一名第一年的分析师,正在尝试尝试我的脚。Superior告诉我,连接到S3需要一段时间,所以这也是避免连接的一个原因。谢谢!
发布于 2020-02-15 06:25:02
已修复。只需将.json证书添加到部署包中。我在使用secret.json时遇到了一个问题,所以我的.py脚本(再一次,使用pandas )混合了层和部署包。谢谢!
https://stackoverflow.com/questions/60233826
复制相似问题