Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PythonGSpread-创建电子表格URL路径后,如何在中获取该路径?_Python_Url_Google Sheets_Google Drive Api_Gspread - Fatal编程技术网

PythonGSpread-创建电子表格URL路径后,如何在中获取该路径?

PythonGSpread-创建电子表格URL路径后,如何在中获取该路径?,python,url,google-sheets,google-drive-api,gspread,Python,Url,Google Sheets,Google Drive Api,Gspread,我正在尝试使用gspreadpython包创建一个新的电子表格,然后获取它的URL路径(在google驱动器内)并将其发送给其他人,以便他们也可以进入 我试图找到一个答案,但没有成功 我创建了一个全新的电子表格: 导入gspread 从gspread_dataframe导入get_as_dataframe,使用_dataframe设置_ gc=gspread_connect() 电子表格=gc.create(‘测试表’) 然后我将其与我的帐户共享: 电子表格。共享('我的_user@my_co

我正在尝试使用
gspread
python包创建一个新的电子表格,然后获取它的URL路径(在google驱动器内)并将其发送给其他人,以便他们也可以进入

我试图找到一个答案,但没有成功

我创建了一个全新的电子表格:

导入gspread
从gspread_dataframe导入get_as_dataframe,使用_dataframe设置_
gc=gspread_connect()
电子表格=gc.create(‘测试表’)

然后我将其与我的帐户共享:

电子表格。共享('我的_user@my_company.com,perm_type='user',role='writer')

然后我在里面写了一些随机的东西:

工作表=gc.open(“测试表”)。表1
df=pd.DataFrame.from_记录([{'a':i,'b':i*2}表示范围(100)])
使用数据帧设置数据帧(工作表,df)

现在,当我转到我的谷歌硬盘时,我可以通过查找它的名称(“测试表”)找到这张表

但是我不知道如何在python代码中获得URL路径,这样我就可以立即将它传递给其他人


Tnx

您可以使用生成URL。下面是一个使用代码中的
电子表格
变量的示例:

spreadsheet_url = "https://docs.google.com/spreadsheets/d/%s" % spreadsheet.id