【问题标题】:How to delete the complete spreadsheet using gspread, python如何使用 gspread、python 删除完整的电子表格
【发布时间】:2020-05-28 16:33:31
【问题描述】:

这是我的代码,用于邀请 没有 参加 google meet 会议的朋友出席。

我们使用组织电子邮件,所以每个人都有他们的名字作为他们的卷号。

使用Meet Attendance在电子表格中注明分机号(出席者)。

import gspread
from oauth2client.service_account import ServiceAccountCredentials

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"]


creds = ServiceAccountCredentials.from_json_keyfile_name('Client_secret.json', scope)

client = gspread.authorize(creds)

url = "Url of my SpreadSheet"
sheet = client.open_by_url(url).sheet1

# 66
try:
    cell = sheet.find('566')
    pass
except gspread.exceptions.CellNotFound:
    print('566 Absent')


# 67
try:
    cell = sheet.find('567')
    pass
except gspread.exceptions.CellNotFound:
    print("567 Absent")

# 68, etc...

# ----------------------------------------------------
# Code to delete the spreadsheet once the work is done.
# ----------------------------------------------------

我有责任将缺勤名单提供给经理。

我试图节省我的存储空间我不能一直手动删除电子表格,这就是为什么我需要一个代码来使用gspread删除完整的电子表格

【问题讨论】:

    标签: python-3.x google-sheets-api gspread


    【解决方案1】:

    您可以使用Client.del_spreadsheet() 方法删除电子表格。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多