I wrote a script that takes an excel file and transforms it into a data frame then upload its value to a google sheet. my problem is that I change the row range manually and I want it to append to the next row automatically
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()