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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file gsheet_plots-0.0.0.tar.gz.

File metadata

  • Download URL: gsheet_plots-0.0.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.2

File hashes

Hashes for gsheet_plots-0.0.0.tar.gz
Algorithm Hash digest
SHA256 61de34d834ff8dced26005842f30edb83b83e953243a643680f1de0075214a3d
MD5 f54d0724c3df34a11eee075f477c308e
BLAKE2b-256 ccbcb7df104e0e22a82b3ec26816bad31a7733e53fa2880e6dae8a4dbb4d917f

See more details on using hashes here.

File details

Details for the file gsheet_plots-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: gsheet_plots-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.2

File hashes

Hashes for gsheet_plots-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c96ffd45f7a2431a433293ca2de6ca626c9da978876e8c5f8743a246dc6b5728
MD5 a3e9ee95065556195d4effc596265e49
BLAKE2b-256 c35e2fcad624bdb6848e5b77b77fee4427c4b7d6e792baa7863a7e0e518a4bd9

See more details on using hashes here.

Supported by

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