In the same folder you downloaded the json create a example.groovy
file:
import com.google.api.services.sheets.v4.SheetsScopes
import com.google.api.services.drive.DriveScopes
import es.edn.groogle.*
@Grab("es.edn:groogle:4.0.0-rc4")
@GrabConfig(systemClassLoader=true)
groogle = GroogleBuilder.build {
withOAuthCredentials {
applicationName 'test'
scopes DriveScopes.DRIVE, SheetsScopes.SPREADSHEETS
usingCredentials "client_secret.json"
storeCredentials true
}
}
groogle.with {
service(DriveService).with {
findFiles {
eachFile {
println "$id = $file.name"
}
}
}
}
in a terminal console execute:
if all goes well a browser will be opened and you need to indicate which Google account you want to use
and allow access to the application
Now you can close the browser and see how the script was able to iterate over your files