Load data into Google Sheets Spreadsheet

def loadToGoogleSheets(some_dataframe, spreadsheet_id, worksheetNumber = 0):
    """loads a csv file into a specified Tab in a specified Google Spreadsheet.
    Can load data up to 21 columns"""
    
    import gspread
    from oauth2client.service_account import ServiceAccountCredentials
    
    scope = ['https://spreadsheets.google.com/feeds']
    
    credentials_file = 'AccessKey.json'
    
    credentials = ServiceAccountCredentials.from_json_keyfile_name(credentials_file, scope)
    
    gc = gspread.authorize(credentials)
    
    sht = gc.open_by_key(spreadsheet_id)
    worksheet = sht.get_worksheet(worksheetNumber)
    
    stringList = ["A2:A", "B2:B", "C2:C", "D2:D", "E2:E", "F2:F", "G2:G", "H2:H", "I2:I", "J2:J", "K2:K", "L2:L", "M2:M", "N2:N", "O2:O", "P2:P", "Q2:Q", "R2:R", "S2:S", "T2:T", "U2:U", "V2:V", "W2:W", "X2:X", "Y2:Y", "Z2:Z"]
    
    colNum = len(some_dataframe.columns)
    
    stringList = stringList[0:colNum]
    
    
    
    # add column names
    try:
        for i in range(colNum):
            worksheet.update_cell(1, i+1, some_dataframe.columns[i])
    except:
        print("Failed to write in column names")
    
    # add data
    try:
        maxRow = len(some_dataframe) + 1
        worksheet.resize(rows = maxRow + 1000, cols = 30)
        
        for i in range(colNum):
            myString = stringList[i] + str(maxRow)
            cell_list = worksheet.range(myString)
            
            for x in range(len(cell_list)):
                cell_list[x].value = some_dataframe.iloc[x, i]
            
            worksheet.update_cells(cell_list)
            
        
    except:
        print("Failed to write data")
        

    
    return None