Skip to main content
1) Create client_secret.json in Google APIs Console:
- Create new project in Google APIs Console(https://console.developers.google.com/iam-admin/projects);
- Open the Credentials page (https://console.developers.google.com/apis/credentials) and create new credentials Add credentials > OAuth 2.0 client ID;
- In 'Type of application' select 'Other types' and enter the name of client(for example 'Spreedsheet client') and press 'Create';
- Select your created client and download it like a JSON file;
- Rename json file to 'client_secret.json' and put it to your project dir
- Activate Google Drive API and Google Sheets API in Google Dev. Console (https://console.developers.google.com/apis/library)

2) Create an instance of an object:
- Import SpreadsheetWorker and PERMISSION_TYPES to your project
- Сreate an instance of the class SpreadsheetWorker and pass to him a path to your client_secret.json file as first argument. Then you can pass title spreadsheet, that will be created

!!!REMARK!!!: when you run creating of spreadsheet for the first time and accept agreement in your browser, may happen, that your spreadsheet will not created. To solve this problem, just run script again. This problem is connected with the creation of .credentials directory.

3) Import package:
from PythonGoogleSpreadsheet.PythonGoogleSpreadsheet import SpreadsheetWorker, PERMISSION_TYPES

Methods of python-google-spreadsheet:
- spreadsheet_constructor(output_data):
Create new Google Spreadsheet
If output_data not define, spreadsheet generator create new empty spreadsheet with access permission only for user, who allowed using his data for app (in browser). Else create new spreadsheet with access permission only for user, who allowed using his data for app (in browser) and data from output_data

:param output_data(non-requirement): <list> - data for recording to Spreadsheet (if not specified, spreadsheet will be create empty)
example:
output_data = [
['Iron Man', 'Tony Stark'],
[43, 1.75, 80],
['Just like his costume;-]']
]
:return: new spreadsheet id

- record_data(output_data, spreadsheet_id):
Record data to spreadsheet

:param output_data: <list> - data for recording to Spreadsheet
:param spreadsheet_id: <str> - id of modifying spreadsheet
:return: <dict> - response from Google

- get_spreadsheet_data(spreadsheet_id, sheet_name, sheet_range):
Get data from spreadsheet by sheet name and sheet range
!!!REMARK!!!: sheet_name must be consist of letters of the Latin alphabet

:param spreadsheet_id: <str> - id of modifying spreadsheet
:param sheet_name: <str> - name of sheet from which the data will be taken
:param sheet_range: <str> - range of columns(Example - 'A3:B10').
:return: <list> - array of values from selected sheet in spreadsheet

- add_permission(spreadsheet_id, permission_type, user_email):
Add new permission to spreadsheet with id spreadsheet_id

:param spreadsheet_id: <str> - spreadsheet id
:param permission_type: <str> - type of permission, that apply to the spreadsheet
:param user_email(non-requirement): <str> - email of user, to which is added permission
:return: response or None

- show_permissions(spreadsheet_id):
Show all permissions of selected spreadsheet (with id spreadsheet_id)

:param spreadsheet_id: <str> - spreadsheet id
:return: <dict> - permissions

- remove_permission(spreadsheet_id, permission_id):
Remove permission by id of permission

:param spreadsheet_id: <str> - spreadsheet id
:param permission_id: <str> - id of permission to delete(can get in from response of show_permission-method)
:return: ''

Metadata

Release files for spreadsheet-maker 1.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 spreadsheet-maker 1.0
File Size Uploaded
spreadsheet_maker-1.0.tar.gz 5.7 kB Details

Release files / spreadsheet_maker-1.0.tar.gz

Download URL spreadsheet_maker-1.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
855fe72f421c349c7f2f77cae428b13a72cb2e895dacbb4a86843e627af39b96
BLAKE2b-256 checksum
How to use checksums
b85b52ff69293ca68389a0908335d94e2b2af96ffe1f6041bb920c19f62258fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file

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