Created
June 27, 2019 23:52
-
-
Save DataSolveProblems/c0b4e0194c60bcf21ce225db492ea97f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Google import Create_Service | |
import win32com.client as win32 | |
xlApp = win32.Dispatch('Excel.Application') | |
wb = xlApp.Workbooks.Open(r"<Excel File Path>") | |
ws = wb.Worksheets('<Worksheet Name>') | |
rngData = ws.Range('A1').CurrentRegion() | |
# Google Sheet Id | |
gsheet_id = '<Google Sheet Id>' | |
CLIENT_SECRET_FILE = 'client_secret.json' | |
API_SERVICE_NAME = 'sheets' | |
API_VERSION = 'v4' | |
SCOPES = ['https://www.googleapis.com/auth/spreadsheets'] | |
service = Create_Service(CLIENT_SECRET_FILE, API_SERVICE_NAME, API_VERSION, SCOPES) | |
response = service.spreadsheets().values().append( | |
spreadsheetId=gsheet_id, | |
valueInputOption='RAW', | |
range='WorksheetName!A1', | |
body=dict( | |
majorDimension='ROWS', | |
values=rngData | |
) | |
).execute() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment