openpyxl阅读谷歌每月预算模板表



我复制了我使用谷歌月度预算表模板制作的月度预算报告,当我尝试使用openpyxl制作工作簿对象并尝试通过使用type()函数验证对象时,python返回nonetype错误。有没有人知道openpyxl是否可以阅读从谷歌每月预算表模板制作的谷歌表?(下面的代码只测试openpyxl是否可以在本地下载的情况下使用每月预算模板读取Google表单。如果您想使用google drive api进行修改,这里是url: https://docs.google.com/spreadsheets/d/1oUGwLLZT_4Yuc65N-N7i4WjlBZZSAz9Av9Ni4IpflCY/edit?usp=sharing)如果您需要其他任何东西,请询问

下面是一个代码示例:
def write_to_expense_report():

wb = openpyxl.load_workbook("C:\Users\mander8317\Documents\Programming\convert-bank-statement-to-expense-report\jan-test-budget.xlsx")
print("test returning the sheetnames of the google sheet")
print(wb.sheetnames)

Google sheets有自己的API (Python文档)。您需要使用Google的API从工作表中读取数据,然后使用openpyxl创建一个新的工作簿并输入数据。

最新更新