Your work is 80% DONE, I have just created a python script that works with google drive, it downloads all the files and can easily change the files extension to JPG, I just need more information about what do you want to do in the sorting part (20% of the work).
Send me a message, so you can see the google drive downloader part and explain me the rest (did this in 1:30 hour only).
Greetings.