Package: gsspread10
GSSPREAD10IntroductionThis is an python package which helps us to read the data of google spread sheets from your google drive and then you can manipulate the data usingpandasand plot graph usingmatplotlibFeaturesEasy to useEasy to understandVery helpful for reading the data from Google SheetsInside the PackageBefore installing this package there is one important thing which you have to do first. You have to enable your Google Drive API and Google Sheets API fromGoogle APIs Console.Steps to enableGoogle Drive APIGo to the Google APIs Console.Create a new project.Click Enable API. Search for and enable the Google Drive API.Create credentials for a Web Server to access Application Data.Name the service account and grant it a Project Role of Editor.Download theJSONfile.Give any specfic name of yourJSONfileOpen yourJSONfile and copy the e-mail.Open yourGOODLE SPREADSHEETSand click on share open on the right top.Paste youre-mailand then click on send button.Code DiscriptionLibrary UsedI have used thegspreadandoauth2clientservice to authorize and make API calls to Google Cloud Services.Importing Librarypipinstallgspreadoauth2clientFeatures ofgspreadlibraryGoogle Sheets API v4.Open a spreadsheet by title, key or url.Read, write, and format cell ranges.Sharing and access control.Batching updates.Aboutoauth2clientThis library will help us to get the client credientials a to read the data of specific Spread Sheet.LET'S GET STARTEDHow to Installpipinstallgsspread10The name of this package is "gspread10" and you can use this package to read the data fromGOODLE SPREADSHEETSinJSONformat and then usingpandasyou can manipulate the data in table usingDataFramesand for Data Visualization you can useMatplotlib.Function to read the dataTo read the data from c you have to usegetjsonGspreadData(json_file, gspread_file)function and inside the function you have to give the path of yourJSONfile and the name of yourGOODLE SPREADSHEETS.
For example:- I want to read the data fromGreendeckAssignment file. So Here How it should be written.getjsonGspreadData("your_JSON_Path","Greendeck Assignment")Code for Reading the file fromGOODLE SPREADSHEETS# Google Sheets Features.# Open a spreadsheet by title, key or url.# Read, write, and format cell ranges.# Sharing and access control.# Batching updates.# oauth2client library will help us to get the client credientials a to read the data of specific Spread Sheet.importgspreadfromoauth2client.service_accountimportServiceAccountCredentialsimportpandasaspddefgetjsonGspreadData(json_file,gspread_file):# use creds to create a client to interact with the Google Drive APIscope=["https://spreadsheets.google.com/feeds","https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"]creds=ServiceAccountCredentials.from_json_keyfile_name(json_file,scope)client=gspread.authorize(creds)# Find a workbook by name and open the first sheet# Make sure you use the right name here.sheet=client.open(gspread_file).sheet1# Extract and print all of the valueslist_of_gspread=sheet.get_all_records()# return list_of_gspreaddata=pd.DataFrame.from_dict(list_of_gspread)returndata# print(getjsonGspreadData("D:\\project videos\\Google sheets\\client_secret.json", "Greendeck Assignment"))I went throung several websites to get the idea of 'How to read data from Goofle Spread Sheet'. So finally I got this website -->mediam.com. You can go through this website.LicenseThis package is distributed under theMIT license.