Skip to main content

gsheet will help to create your connection between google sheet and python through API and help to plot graph by you choice

Project description

gsheetplots_

gheetplot is small wrapper around Google Sheet API ,Pandas and Matplotlib provide access to Google Sheet and help to plot graph with desired axis by user .

To access Google Sheet one need to Turn_on_the_API , download service credinatial JSON file and use read_spreadsheet() to read spreadsheet and underneath it takes the help of gspread ,ServiceAccountCredentials to create connection with Google Sheet API and function convert it into a dataframe which can be used data analysis .

Table of contents

Link

Installation

This package runs under Python 3.5+ ,use pip to install

 pip install gsheetplot

This will install gsheetplot module you need to install gspread

Requirements: Python 2.7+ or Python 3+

pip install gspread

you need install oauth2client to use ServiceAccountCredentials

pip install oauth2client

Quickstart

Log into the Google Developers console with the google account whose spreadsheets you want to access . Create(or select) a project and enable the Drive APP and Sheet API under (Google Apps APIs).

Steps for turn on API

1__ Go to google API console

2__ create new project

3__ Click Enable API. Search for and enable the Google Drive API.

4__ Create credentials for a Web Server to access Application Data.

5__ Name the service account and grant it a Project Role of Editor.

6__ Download the JSON file 7__ Copy the JSON file to your code directory and rename it to client_secret.json

                          this some how its looklike


                          {

                          "type": "service_account",

                          "project_id": "spreadsheet-291117",

                          "private_key_id":_________________,

                          "private_key":  _______ here will be some key,

                          "client_email": "________________,

                          "client_id": __________________________,

                          [auth_uri]("https://accounts.google.com/o/oauth2/auth"),

                          [token_uri]("https://oauth2.googleapis.com/token"),

                          [auth_provider_x509_cert_url]("https://www.googleapis.com/oauth2/v1/certs"),

                          [client_x509_cert_url](https://www.googleapis.com/robot/v1/metadata/x509/spreadsheet%40spreadsheet-291117.iam.gserviceaccount.com"),

                          }

8__ if you spread sheet is private then you have give drop client_email of JSON file to share with client file

Create a object to acces member function and convert into dataframe

#import libary
from plotgraph import GET

#url of the spreadsheet
connection_url='https://docs.google.com/spreadsheets/d/1077QfadB_V_Nl8-jomsb62RYyrs0_Is-IGlVRl8QF2I/edit?usp=sharing'

#servicecrendiatl JSON file
driveouth_json='spreadsheetouth.json'

#creating a object to access member function
>>> dataframeObj=GET.read_sheet_to_dataframe(connection_url,driveouth_json)

#converting to dataframe
dataframe=dataframeobj.read_spreadsheet()

Option for user input

#tuple for X axis and y axis
X,Y=dataframe.select_axis()

plot graph with user input

#input from user
>>> X,Y=dataframe.select_axis()

#calling plot function

plot=r.plot_chart(g,X,Y,'line',imagename='test')

you can provide range of data example from (200,500)

plot=r.plot_chart(g,X,Y,'line',range=(200,500),imagename='test')

imagename is name of image that will saved in system you can make empty also

plot=r.plot_chart(g,X,Y,'line')

diffrent kind of plot

#plot kde
plot=r.plot_chart(g,X,Y,'kde')

Languages_and_API

See_also

  • Google Sheets API : Read, write, and format data in Sheets. The latest version of the Sheets API lets developers programmatically

  • Pandas : pandas is a software library written for the Python programming language for data manipulation and analysis

  • gspread : Python wrapper, currently using the XML-based legacy v3 API example Jupyter notebook using gspread_ to fetch a sheet into a pandas DataFrame

  • matplotlib : Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy

Contact

Created by Abhishek pratap singh

License

This package is distributed under the MIT license_.# gsheetplot

gheetplot is small wrapper around Google Sheet API ,Pandas and Matplotlib provide access to Google Sheet and help to plot graph with desired axis by user .

To access Google Sheet one need to Turn_on_the_API , download service credinatial JSON file and use read_spreadsheet() to read spreadsheet and underneath it takes the help of gspread ,ServiceAccountCredentials to create connection with Google Sheet API and function convert it into a dataframe which can be used data analysis .

Table of contents

Link

  • GitHub :
  • PyPi:
  • Documention:
  • Download

Installation

This package runs under Python 3.5+ ,use pip to install

 pip install gsheetplot

This will install gsheetplot module you need to install gspread

Requirements: Python 2.7+ or Python 3+

pip install gspread

you need install oauth2client to use ServiceAccountCredentials

pip install oauth2client

Quickstart

Log into the Google Developers console with the google account whose spreadsheets you want to access . Create(or select) a project and enable the Drive APP and Sheet API under (Google Apps APIs).

Steps for turn on API

1__ Go to google API console

2__ create new project

3__ Click Enable API. Search for and enable the Google Drive API.

4__ Create credentials for a Web Server to access Application Data.

5__ Name the service account and grant it a Project Role of Editor.

6__ Download the JSON file 7__ Copy the JSON file to your code directory and rename it to client_secret.json

                          this some how its looklike


                          {

                          "type": "service_account",

                          "project_id": "spreadsheet-291117",

                          "private_key_id":_________________,

                          "private_key":  _______ here will be some key,

                          "client_email": "________________,

                          "client_id": __________________________,

                          [auth_uri]("https://accounts.google.com/o/oauth2/auth"),

                          [token_uri]("https://oauth2.googleapis.com/token"),

                          [auth_provider_x509_cert_url]("https://www.googleapis.com/oauth2/v1/certs"),

                          [client_x509_cert_url](https://www.googleapis.com/robot/v1/metadata/x509/spreadsheet%40spreadsheet-291117.iam.gserviceaccount.com"),

                          }

8__ if you spread sheet is private then you have give drop client_email of JSON file to share with client file

Create a object to acces member function and convert into dataframe

#import libary
>>> from gsheetplot import GET

#url of the spreadsheet
connection_url='https://docs.google.com/spreadsheets/d/1077QfadB_V_Nl8-jomsb62RYyrs0_Is-IGlVRl8QF2I/edit?usp=sharing'

#servicecrendiatl JSON file
driveouth_json='spreadsheetouth.json'

#creating a object to access member function
>>> dataframeObj=GET.read_sheet_to_dataframe(connection_url,driveouth_json)

#converting to dataframe
dataframe=dataframeobj.read_spreadsheet()

Option for user input

#tuple for X axis and y axis
X,Y=dataframe.select_axis()

plot graph with user input

#input from user
>>> X,Y=dataframe.select_axis()

#calling plot function

plot=r.plot_chart(g,X,Y,'line',imagename='test')

you can provide range of data example from (200,500)

plot=r.plot_chart(g,X,Y,'line',range=(200,500),imagename='test')

imagename is name of image that will saved in system you can make empty also

plot=r.plot_chart(g,X,Y,'line')

diffrent kind of plot

#plot kde
plot=r.plot_chart(g,X,Y,'kde')

Languages_and_API

See_also

*Google Sheets API help you to under stand how enable API

*Pandas for more information in data manupulations and other feature

*gspreadPython wrapper, currently using the XML-based legacy v3 API example Jupyter notebook using gspread_ to fetch a sheet into a pandas DataFrame

*matplotlib it will provide helpfull feature to change title,label ,color etc of graph

*ServiceAccountCredentials it will help to understand about connection of API in python

Contact

Created by Abhishek pratap singh

License

This package is distributed under the MIT license_.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gsheet_plots-0.0.0.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

gsheet_plots-0.0.0-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page