我正在寻找最有效的方法来检查Google Sheets是否和何时使用pygsheet进行了修改。
我目前的方法是:
(Py):
gc = pygsheets.authorize(service_file=gServiceAccAuthFile, retries=1)
# Open spreadsheet
sh = gc.open_by_key(gSheetKey)
# Open Worksheet
wks = sh.worksheet_by_title(gWorksheetName)
# Export as CSV
wks.export(pygsheets.ExportType.CSV, path=outputDir + '/', filename=outputFileName)(BASH):
compare_sha() {
# Compare Previous Sha to New File Sha
log_output "Original SHA: ${1}\tNew SHA: ${2}"
if [[ $1 == $2 ]]; then return 1; else return 0; fi
}
if compare_sha $origSha $newSha || [[ "$force" == '1' ]];
then ...
else ...
fi但这感觉很笨拙。并要求下载完整的工作表(每60秒检查一次)
有没有更好的方法直接集成到pygsheet或python中?在bash中有没有更有效的方法?
发布于 2019-06-26 20:05:16
Pygsheet电子表格模型有一个更新的属性,它将给出工作表最后一次更新的时间戳。
updated_time = sh.updated
https://stackoverflow.com/questions/56767990
复制相似问题