# Bash script to download Google Playstore Earnings **Published by:** [josue.0](https://paragraph.com/@holajosue/) **Published on:** 2023-07-22 **URL:** https://paragraph.com/@holajosue/bash-script-to-download-google-playstore-earnings ## Content You need to first get corresponding index for the month and year at which you will start exporting. Check playstore to do it:In the screenshot the index for June 2023 is 28. Then replace the month (1-indexed), year, index range (28 to 30) and the other 2 IDs (5542242580359385 and 11347471111894874436) in the script. You can get those 2 IDs from the download URL of one file:Not sure if specifying --project is required. The script is:#!/bin/bash # Initialization year=2022 month=1 isfirst=1 # Loop for index in {28..30} do # Print formatted output yearmonth=$(printf "%d%02d" $year $month) zipfile=$(printf "earnings_%s_5542242580359385-%d.zip" $yearmonth $index) objpath=$(printf "gs://pubsite_prod_rev_11347471111894874436/earnings/%s" $zipfile) gcloud --project=tumicro-1221 storage cp "$objpath" . unzip "$zipfile" if [ $isfirst -eq 0 ]; then tail -n+2 "PlayApps_$yearmonth.csv" >> out.csv else cat "PlayApps_$yearmonth.csv" >> "out.csv" fi isfirst=0 # Increment month and index month=$((month+1)) index=$((index+1)) # If month exceeds 12, increment year and reset month if [ $month -gt 12 ]; then year=$((year+1)) month=1 fi done It will generate a single csv file containing all the reports appended (out.csv). Feel free to use it and to suggest improvements or provide feedback ✌️ ## Publication Information - [josue.0](https://paragraph.com/@holajosue/): Publication homepage - [All Posts](https://paragraph.com/@holajosue/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@holajosue): Subscribe to updates - [Twitter](https://twitter.com/holajosue): Follow on Twitter