Git Product home page Git Product logo

google-products-with-python's Introduction

This repository has python scripts to access google products (Big Query, Cloud SQL,Google sheets, Google Analytics).


To access BigQuery, Cloud SQL, Google Analytics, you must have a project on google cloud platform and a service account.

How to get a project and a service account ?

See documentation for help here and here

To access Google Analytics, you must have permissions to view google analytics account [user account is sufficient]. 
To access google sheets, you must have permission to edit google sheet to be accessed. 

Usage

When you run bq.py for the first time, it will produce a link to authorize and ask to enter authorization code. Copy & paste url in browser and authorize application.

$ cd google-products-with-python

$ python3 bq.py 

   age workclass  functional_weight education  education_num       marital_status occupation  ...    race      sex capital_gain  capital_loss  hours_per_week  native_country income_bracket
0   34         ?             164309      11th              7   Married-civ-spouse          ?  ...   White   Female            0             0               8   United-States          <=50K
1   21         ?             212888      11th              7   Married-civ-spouse          ?  ...   White   Female            0             0              56   United-States          <=50K
2   28         ?             308493   HS-grad              9   Married-civ-spouse          ?  ...   White   Female            0             0              17        Honduras          <=50K
3   47         ?             331650   HS-grad              9   Married-civ-spouse          ?  ...   White   Female            0             0               8   United-States           >50K
4   22         ?              35448   HS-grad              9   Married-civ-spouse          ?  ...   White   Female            0             0              22   United-States          <=50K

$ cd google-products-with-python
# Replace credentials and database server details with your credentials and database server details in csql.py.
$ python3 csql.py

gs.py is a self explanatory python script.
To learn more, please read Medium article.

  • Get view id from your google analytics account and get client secret from google service account.
  • Replace view id and client secret path in ga.py.
  • Edit start and end dates in ga.py.
  • Edit metrics on ga.py.

References :

1. https://cloud.google.com/sql/docs/mysql/connect-external-app#python
2. https://cloud.google.com/bigquery/docs/pandas-gbq-migration
3. https://pygsheets.readthedocs.io/en/latest/index.html
4. https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-py

google-products-with-python's People

Contributors

dc-aichara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.