Skip to content

Instantly share code, notes, and snippets.

@IJEMIN
Created January 1, 2019 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IJEMIN/195f1492d76d491f9154b399a391b956 to your computer and use it in GitHub Desktop.
Save IJEMIN/195f1492d76d491f9154b399a391b956 to your computer and use it in GitHub Desktop.
Download Google Play Console Sales Report from google cloud storage
from google.cloud import storage
import os
certificationJsonFile = 'XXXXX.json'
bucketName = r'pubsite_prod_rev_XXXXXX'
reportYear = 2018
# Connecte with Service Account
storage_client = storage.Client.from_service_account_json(certificationJsonFile)
# Get Bucket contain sales data
bucket = storage_client.get_bucket(bucketName)
# Get blobs contain 'sales' prefix
prefix = 'sales'
blobs = bucket.list_blobs(prefix=prefix)
if not os.path.isdir(prefix):
os.mkdir(prefix)
for blob in blobs:
if str(reportYear) in blob.name:
blob.download_to_filename(r'./' + blob.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment