Last active
October 26, 2020 10:45
-
-
Save songokjesse/7c547d3afa849fc29df2e2583f53544e to your computer and use it in GitHub Desktop.
Creating a new google sheet workbook and transferring pandas dataframe data
This file contains 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
def createMasterListWorkSheet(): | |
# get cleaned data from the RemoveDuplicateData Function | |
newData = RemoveDuplicateData() | |
# get the row count from the dataframe and convert to type int so as to be serialized to json (Produces error if not converted) | |
rowCount = int(newData['hits'].count()) | |
# create a new sheet | |
sheet.add_worksheet(title="MASTER_LIST", cols=6, rows=rowCount + 1) | |
# Get the instance | |
newSheet = sheet.worksheet("MASTER_LIST") | |
# Insert the cleaned data | |
newSheet.insert_rows(newData.values.tolist()) | |
# # Insert headers to the masterlist worksheet by calling the InsertHeader Function | |
createWorksheetHeader(newSheet) | |
print("Successfully Created MASTER LIST Worksheet") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment