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 ✌️