简体   繁体   English

如何通过谷歌应用引擎从谷歌表格中读取数据?

[英]How to read data from google sheet through google app engine?

I have a local flask app that is reading data from a csv file.我有一个本地 flask 应用程序正在从 csv 文件中读取数据。 Using the below code, I am able to successfully read in the data from columns one and two of a spreadsheet called "Vocab".使用下面的代码,我能够成功地从名为“Vocab”的电子表格的第一列和第二列中读取数据。 the "service_account.json" is currently saved in my local working directory with my other application files. “service_account.json”当前与我的其他应用程序文件一起保存在我的本地工作目录中。

    gc = gspread.service_account(filename='service_account.json')
    sh = gc.open("Vocab")
    worksheetOne = sh.sheet1
    self.columnOne = [str(i) for i in worksheetOne.col_values(1)]
    self.columnTwo = [str(i) for i in worksheetOne.col_values(2)]

I am now trying to deploy this flask app to google app engine, but I am not sure on how to replace the local "service_account.json" file that I am using for credentials so that I am able to access my google sheet info.我现在正在尝试将此 flask 应用程序部署到谷歌应用程序引擎,但我不确定如何替换我用于凭据的本地“service_account.json”文件,以便我能够访问我的谷歌表信息。 What would be the best way to access my google sheet info from my google app?从我的谷歌应用程序访问我的谷歌工作表信息的最佳方式是什么?

Why do you need to replace it?为什么需要更换它? You can include it in the deploy so it is read the same way您可以将其包含在部署中,以便以相同的方式读取

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM