Easily send data to Google Sheets
Project description
pyspreadsheet
=====
A python package to easily send data to Google Sheets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1) Installation
'''''''''''''''
Open a terminal and install pyspreadsheet package
::
pip install pyspreadsheet
2) Use
''''''
1) Find a client_secrets.json file
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.
2) Be sure that you have set environment variables with path to client_secrets.json file (by default ./) and a path where pyspreadsheet will store Google Credentials (by default ./)
::
export GOOGLE_CLIENT_SECRET_PATH="./"
export GOOGLE_CREDENTIALS_PATH="./"
3) Prepare your data like that:
.. code:: python
data = {
"worksheet_name" : 'name_of_the_worsheet_you_want_to_send_data'
"columns_name" : [first_column_name,second_column_name,...,last_column_name],
"rows" : [[first_raw_value,second_raw_value,...,last_raw_value],...]
}
4) Send your data to the right with the sheet_id paramater:
.. code:: python
import pyspreadsheet
pyspreadsheet.send_to_sheet(sheet_id, data)
- pyspreadsheet will warn you if it has to overwrite some data, except if first row (column_name) are the same than column_name you want to send
2) Import from Redshift to Google Sheets
''''''''''''''''''''''''''''''''''''''''
pyspreadsheet has a function to export result of a Amazon Redshift query to a Google Sheet. This use `pyred <https://github.com/dacker-team/pyred/>`_.
Simply write:
.. code:: python
import pyspreadsheet
pyspreadsheet.redshift.query_to_sheet(sheet_id, worksheet_name, instance, query)
=====
A python package to easily send data to Google Sheets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1) Installation
'''''''''''''''
Open a terminal and install pyspreadsheet package
::
pip install pyspreadsheet
2) Use
''''''
1) Find a client_secrets.json file
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.
2) Be sure that you have set environment variables with path to client_secrets.json file (by default ./) and a path where pyspreadsheet will store Google Credentials (by default ./)
::
export GOOGLE_CLIENT_SECRET_PATH="./"
export GOOGLE_CREDENTIALS_PATH="./"
3) Prepare your data like that:
.. code:: python
data = {
"worksheet_name" : 'name_of_the_worsheet_you_want_to_send_data'
"columns_name" : [first_column_name,second_column_name,...,last_column_name],
"rows" : [[first_raw_value,second_raw_value,...,last_raw_value],...]
}
4) Send your data to the right with the sheet_id paramater:
.. code:: python
import pyspreadsheet
pyspreadsheet.send_to_sheet(sheet_id, data)
- pyspreadsheet will warn you if it has to overwrite some data, except if first row (column_name) are the same than column_name you want to send
2) Import from Redshift to Google Sheets
''''''''''''''''''''''''''''''''''''''''
pyspreadsheet has a function to export result of a Amazon Redshift query to a Google Sheet. This use `pyred <https://github.com/dacker-team/pyred/>`_.
Simply write:
.. code:: python
import pyspreadsheet
pyspreadsheet.redshift.query_to_sheet(sheet_id, worksheet_name, instance, query)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyspreadsheet-0.0.16.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for pyspreadsheet-0.0.16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e93682af1886c794d2b970a805ec0c925c57fc9dc2aaa8d7f22da6a7494e2ad |
|
MD5 | efa071bcc20b34f34bbbe644444a9988 |
|
BLAKE2b-256 | dc57a2171c58292b90b756161a6007de8d5c540d68c8769d85bb03ebe235158f |