Skip to main content

GSHEET_IMAGE_GENERATOR

Use of this API

An awesome package which helps us in creating a graph from Google Sheets and stores them as an image. The Graph is plotted by selecting two columns from the sheet i.e. for x-axis and y-axis.


Installation

pip install gsheet_image_generator

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 API and Sheets API (under Google Apps APIs).

Go to the Credentials for your project and create New credentials > OAuth client ID > of type Other. In the list of your OAuth 2.0 client IDs click Download JSON for the Client ID you just created. Save the file as client_secrets.json in your home directory (user directory). Another file named storage.json in this example, will be created after successful authorization to cache OAuth data. On your first usage of gsheet_image_generator with this file (holding the client secrets), your web browser will be opened, asking you to log in with your Google account to authorize this client read access to all its Google Drive files and Google Sheets.


How to use it?

Step 1

Open the Terminal and Run the below code to run the API. Pass the Path of the client_secrets.json while calling the Image_generator Class.

>>> from gsheet_image_generator.gsheet_image_generator import Image_generator
>>> Ig=Image_generator(Path)


After Running the above snippet you will see weather your request has granted or not, if granted then you will be asked to select the Spread Sheet from your Google Drive.

Select the respective number then the sheet will be Imported to your local computer.

You can Inspect the Spread Sheet by running the below command after creating an Object for Image_generator() class.

>>> Ig.sheet.head()

If you want to convert a Data type of a column then use the below function.

>>> Ig.convert_dtype(column, type_conversion)

The above function will take two arguments 1st is the column you want to convert and 2nd is Type to which you want to convert like('int', 'float' ,etc...)


If you want to convert a Timestamp column to DateTime then use the below function so that we can convert a timestamp dtype column to datetime dtype column.

>>> Ig.convert_timestamp_to_datetime()

The above function will ask you you select a column from the Dataframe.


If you want to generate year column from datetime column in your Data frame then use the below function.

>>>  Ig.generate_year()

If you want to generate month column from datetime column in your Data frame then use the below function.

>>>  Ig.generate_month()

If you want to generate day column from datetime column in your Data frame then use the below function.

>>>  Ig.generate_day()

If you want to group by entire Data frame on a particular column or liat of coluumns then use the below function.

>>>  Ig.groupby_column(column)

The above function will take one argument i.e either a single column or a more than one column passed as a list.

Generating Graphs as Images


If you want to plot a Line Graph and save it as an Image then Run the below commnad

>>> Ig.plot_line_graph()

By Running the above command you will be asked to select two columns i.e. One For the X-axis and the other one for Y-axis And it will ask you to enter the Path where you want to store the Image on your local computer.


If you want to plot a Bar Graph and save it as an Image then Run the below commnad

>>> Ig.plot_bar_graph()

By Running the above command you will be asked to select two columns i.e. One For the X-axis and the other one for Y-axis And it will ask you to enter the Path where you want to store the Image on your local computer.


If you want to plot a Box Plot and save it as an Image then Run the below commnad

>>> Ig.box_plot()

By Running the above command you will be asked to select two columns i.e. One For the X-axis and the other one for Y-axis And it will ask you to enter the Path where you want to store the Image on your local computer.


If you want to plot a Scatter Plot and save it as an Image then Run the below commnad

>>> Ig.scatter_plot()

By Running the above command you will be asked to select two columns i.e. One For the X-axis and the other one for Y-axis And it will ask you to enter the Path where you want to store the Image on your local computer.

See also


  • gsheets.py - self-contained script to dump all worksheets of a Google Spreadsheet to CSV or convert any sub sheet to a pandas DataFrame (Python 2 prototype for this library)
  • gspread - Google Spreadsheets Python API (more mature and featureful Python wrapper, currently using the XML-based legacy v3 API)

License

This Package is licensed under the MIT license. See License for details.

Metadata

Release files for gsheet-image-generator 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gsheet-image-generator 1.0.0
File Size Uploaded Provenance Actions
gsheet_image_generator-1.0.0.tar.gz 6.0 kB Without provenance Details for gsheet_image_generator-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gsheet-image-generator 1.0.0
File Interpreter ABI Platform Actions
gsheet_image_generator-1.0.0-py3-none-any.whl Python 3 none any Details for gsheet_image_generator-1.0.0-py3-none-any.whl

Total release size: 13.1 kB

Release files / gsheet_image_generator-1.0.0.tar.gz

Download URL gsheet_image_generator-1.0.0.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
935ae0db9a103a3c68144654b0c45b87a57d90afc8145fbe7c20cc01ecd4024e
BLAKE2b-256 checksum
How to use checksums
9bf54c2797f865795c425335efc936ea3e412ac0c91464f4dfd6341eb5184b7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / gsheet_image_generator-1.0.0-py3-none-any.whl

Download URL gsheet_image_generator-1.0.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d4f8b7c6f23482949c671eb16f8cade3d9ac19860a053af727e4b3246762f20
BLAKE2b-256 checksum
How to use checksums
956a211116fc8261ce8765de0c74b5c322e5f5c93510a22065e3cc87fb73aeba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Security for gsheet-image-generator 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page