Skip to content

Google Sheet Unofficial API Package Library Which Simplifies the use of the Sheets API

Notifications You must be signed in to change notification settings

shriekdj/gsheetpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gsheetspy project by Shrikant Dhayje (@shriekdj)

Project Code

from pprint import pprint
from gsheetpy import GoogleSheetConnector

spreadsheeet = GoogleSheetConnector(
	scopes=["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"],
	creds_path="D:\dev\gsheetspy\gsheetpy\creds.json"
)

sheet = spreadsheeet.open_sheet(
	spreadsheet_id='spread_sheet_id',
	sheet_name="Sheet1")

data = sheet.get_all_records()

pprint(data)
python main.py
[{'5': 'CHANGED', 'blue': 'fas', 'hello': 'Entry', 'red': 'Fav Color'},
 {'5': 'Changed Value', 'blue': 'fas', 'hello': 1, 'red': 'Blue'},
 {'5': 5, 'blue': 'blue', 'hello': 'changed value', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'changed value', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'changed value', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'changed value', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'changed value', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'changed value', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'changed value', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'changed value', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'changed value', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'hello', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'hello', 'red': 'red'},
 {'5': 5, 'blue': 'blue', 'hello': 'hello', 'red': 'red'},
 {'5': 'Shreyas', 'blue': 'dsafds', 'hello': 2, 'red': 'Yellow'},
 {'5': 'Priyanka', 'blue': 'dsafdas', 'hello': 3, 'red': 'Pink'},
 {'5': 'Rajesh', 'blue': 'af', 'hello': 4, 'red': 'Green'},
 {'5': 'Varun', 'blue': 'asfd', 'hello': 5, 'red': 'Red'}]

Instructions on Running the file

Google Cloud Console -> Your Project -> API and Services

Google Drive API -> Manage -> Credential Option Near the Quotas -> Create Credentials -> Help me choose

Select Google API Again -> Application Data -> No, I'm not using them -> Create Service Account

Create Service Account By ( Project -> Editor )

  • Create Account With Whatever the Name You Want for me i chose gsheetsbot
  • You Will get an email id of the service account

Download the JSON File Provided by them

Then only enable the Google Sheets API from Library Option Just That

The JSON Credential File Should Be downloaded from Google Drive API not google sheets

While Creating Credentials Json File You Will get an Service Account Email Id

Goto Your Spreadsheet and Click Share Option and Share the File as Editor With Service Account Email Id

About

Google Sheet Unofficial API Package Library Which Simplifies the use of the Sheets API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages