Django-Google-Sheet
- fork this repo
- make new directory for the project. After cd in the new directory
- python3 -m venv venv
- source venv/bin/activate
- git clone --branch <name_of_branch> <http:// github link>
- ls -la
- cd gsheets-with-frontend
- pip3 install -r requirements.txt
- pip3 install -U django-gsheets-import
- python3 manage.py makemigrations
- python3 manage.py migrate
- python3 manage.py createsuperuser
- python3 manage.py loaddata authors works
- python3 manage.py runserver <port ...8081, 8082....>
- go to localhost/admin
- If all is OK you can see the data imported from google sheet template
- create a Google Sheet - here is the example
- Share and give editor rights to that account
- go in GCC (Google Cloud Console)
- go in Cloud Ovierview / Dashboard / Create New Project
- Go in “Enable API Services” > Library and select the following API: Google Sheets API and Google Picker API
- Go in “Enable API Services” > Credentials for official reference
- Go in API > APIs and Services > Ouauth Consent Screen > External > Create: a) only App name, b) User support email and c) Developer contact information > Save and Continue
- Go in “Enable API Services” > Credentials > Create Credentials > OAuth client ID > Application Type: Web Application > Name: Create > and after Authorised JavaScript origins for local testing http://localhost:8000 and after you can also add multiple relevant URIs here
- Dowload JSON: here you can find Your Client ID and Your Client Secret
- Note: Accessing the selected Google Sheet while only using the non-sensitive .../auth/drive.file scope requires the project’s App ID to be set. It is automatically created with each Google Cloud Project and can be found as Project number on your project’s dashboard or under the same name at Main Menu > IAM & Admin > Settings.
- Go in Iam Admin > Create Service Account > Service Account Name > Create and Continue after Grant this Service ... > Select Role > Owner > Continue > Done
- Copy the generated email
- Now in Google Sheets Template that you have created > Sharing > paste the generated email
- Only for testing (not in production) in file settings.py
GSHEETS_IMPORT_API_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
GSHEETS_IMPORT_CLIENT_ID = 'XXXXXXXXXXXXXXXXXXXXX'
GSHEETS_IMPORT_APP_ID = 'XXXXXXXXXXXX'