Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/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
Python 3.x 谷歌工作表API-附加数据帧_Python 3.x_Pandas_Google Sheets Api - Fatal编程技术网

Python 3.x 谷歌工作表API-附加数据帧

Python 3.x 谷歌工作表API-附加数据帧,python-3.x,pandas,google-sheets-api,Python 3.x,Pandas,Google Sheets Api,我编写了一个脚本,将excel文件转换成数据框,然后将其值上传到google工作表。我的问题是,我手动更改了行范围,希望它自动附加到下一行 CLIENT_SECRET_FILE = r'path' API_SERVICE_NAME = 'sheets' API_VERSION = 'v4' SCOPES = ['https://www.googleapis.com/auth/spreadsheets'] gsheetId = 'id' s

我编写了一个脚本,将excel文件转换成数据框,然后将其值上传到google工作表。我的问题是,我手动更改了行范围,希望它自动附加到下一行

    CLIENT_SECRET_FILE = r'path'
    API_SERVICE_NAME = 'sheets'
    API_VERSION = 'v4'
    SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
    gsheetId = 'id'
    
    service = Create_Service(CLIENT_SECRET_FILE, API_SERVICE_NAME, API_VERSION, SCOPES)
    
    def Export_Data_To_Sheets():
        
        URL = r'path'
        df = pd.read_excel(URL)
        df.replace(np.nan, '', inplace=True)
    
        response_date = service.spreadsheets().values().append(
            spreadsheetId=gsheetId,
            valueInputOption='RAW',
            range='Raw-Data!A25:N25', //here is what I want to fix
            body=dict(
                majorDimension='ROWS',
                values=df.T.reset_index().T.values.tolist())
        ).execute()


Export_Data_To_Sheets()

在这种情况下,请删除
!A25:N25
from
range='Raw-Data!A25:N25'
如下所示

修改脚本: 发件人: 致:
  • 通过此修改,
    被附加到
    原始数据表
参考:
range='Raw-Data!A25:N25',
range='Raw-Data',