I am able to successfully get the Execution API Quickstart to work for accessing filenames.
But augmenting the Quickstart script to use Spreadsheet functions triggers an error of type "No authentication challenges found".
The addition of DriveApp.getFilesByName()
does not cause any permissions problems, it is the addition of SpreadsheetApp.create()
that triggers the error. Saving the augmented script generates a message that the script requires additional permissions. I have tried:
- creating/saving a new/complete script so all required permissions are established with the first script instantion
- deleting the app data on the target to force new permissions to be granted
- deleting the app on the target to force new permissions to be granted
- regenerating a new SHA1 key and re-credential-ing with the new key to re-initiate the permission granting process
My code:
function getFoldersUnderRoot() {
var my_ss = "SDRP-Log-Test";
var my_sheet = "month";
var files = DriveApp.getFilesByName(my_ss);
var file = !files.hasNext() ? SpreadsheetApp.create(my_ss) : files.next();
var ss = SpreadsheetApp.openById(file.getId());
var root = DriveApp.getRootFolder();
var folders = root.getFolders();
var folderSet = {};
while (folders.hasNext()) {
var folder = folders.next();
folderSet[folder.getId()] = folder.getName();
}
return folderSet;
}
I have independently verified that the Spreadsheet scripting works correctly via the development interface, so the scripting works.
build.gradle
:
defaultConfig {
applicationId "com.jackb.sdrp"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Development platform:
- Host: Win10 & Android Studio 1.4 (Current patching)
Target:
- Samsung Galaxy S2 & Android 4.1.2
- Samsung Galaxy S5 & Android 5.1.1
By adding SpreadsheetApp calls, you've modified the authentication scope required for your script. You need to update your scope to include Spreadsheets.