[Python] Writing Data Table to Google Sheets

Discussão em 'Python' iniciado por Stack, Novembro 27, 2025.

  1. Stack

    Stack Membro Participativo

    I am interested in taking a "Data Table" I have got through doing a prediction using Orange and writing this to Google Sheets. I have successfully connected to my google sheet using my Python however, I can not seem to read the local data table with Python. I'm thinking I may be over thinking this and that there may be a way to do this easier. Perhaps by somehow using the "Save As" to write it to google sheets but didn't see that under the "Save As" function. Here is the code I have so far.

    import gspread
    from oauth2client.service_account import ServiceAccountCredentials
    # Print nicely
    import pprint
    import Orange
    from Orange.data import *
    #Create scope
    scope = ['https://spreadsheets.google.com/feeds' + ' ' +'https://www.googleapis.com/auth/drive']
    #create some credential using that scope and content of startup_funding.json
    creds = ServiceAccountCredentials.from_json_keyfile_name('C:\\Users\\jlockwood\\Documents\\My Project-7260cd7aa35f.json',scope)
    #create gspread authorize using that credential
    client = gspread.authorize(creds)
    #Now will can access our google sheets we call client.open on StartupName
    sheet = client.open('Ranking Orange').sheet1
    pp = pprint.PrettyPrinter()
    #Access all of the record inside that
    pp.pprint(Orange.version.version)
    pp.pprint(result)
    sheet.update_cell(2,9,'2000')


    So in short the two things I need

    1. Read Data Table from Orange using Python Script
    2. Write this data from Table to Google Sheet using Python Script

    Continue reading...

Compartilhe esta Página