Simple Python CSV to Google Spreadsheet export on run task
- Google API with service account private key
- Panda
- Add color tab on spreadsheet from hex color
- Bypass the raws data limitations from spreadsheet
$ cd csv_gspread
$ pip install -r requirements.txt
- Have a Google account
- Create a project on Google Cloud Console
- Activate a service account credientials Google Cloud console
- Activate Google Services drive and sheet
- Save your json private key to
creds/private_key.json
- copy your generated email for the private key
- Inside you Google drive, create a spreadsheet to share with your creds email
- copy the id of the spreadsheet (from the url)
# spreadsheet ID from url inside brackets pair
https://docs.google.com/spreadsheets/d/{4tZdjfPWOjhd4I-adeTe53Sfks9jcRkA3298fjd}/edit#gid=404311
PATH_TO_URL = "https://www.google.com/earth/outreach/data/sharksightings.csv"; // PATH TO DATA
PATH_TO_CSV = "test.csv"; // PATH TO DATA
SPREADSHEET_ID = "4tZdjfPWOjhd4I-adeTe53Sfks9jcRkA3298fjd"; // YOUR SPREADSHEET ID
WORKSHEET_NAME_1 = "some_test_2"; // YOUR SHEET TAB NAME 1
WORKSHEET_NAME_2 = "some_test_1"; // YOUR SHEET TAB NAME 2
No need to authorise the app, perfect for CRON task or cli usage
$ python3 csv_spread.py