Write in a sheet
mkdir test
cd test
# remember download client_secret.json
nano example2.groovy
example2.groovy
@Grab('com.puravida-sofware.groogle:groogle-sheet:3.0.0')
import com.puravida.groogle.*
import com.google.api.services.sheets.v4.SheetsScopes
import groovy.io.FileType
groogle = GroogleBuilder.build {
withOAuthCredentials {
applicationName 'test-sheet'
withScopes SheetsScopes.SPREADSHEETS
usingCredentials "client_secret.json"
}
service(SheetServiceBuilder.build(), SheetService)
}
groogle.service(SheetService).withSpreadSheet 'SHEET_ID', {
createSheet new Date().format('yyyyMMdd'), {
append{
insert 'Name', 'Size'
new File('.').eachFile{ f->
insert f.name, f.size()
}
}
}
}