I am trying to enable Google Drive API using apps script so that we can upload any file to drive without manual intervention.
edit
function test()
{
var file = DriveApp.getFileById(newSpreadSheet.getId()); file.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
}
This is how I'm setting permission for a spreadsheet using code. I need a similar thing to enable drive API as well.So that anybody can use the spreadsheet without enabling the drive API manually from google developer console.
Thanks in advance
Enabling an API is usually done through the Google Developer Console as given in enabling Google APIs Services wherein you enable them from the Google APIs Services dialog box from the Script Editor then through the Google APIs Console link.
However, if you don't want to go through the Developer Console, you may want to try Connecting to public APIs which is applicable for Google (or non-Google) API that isn't available as an Apps Script service. As mentioned,
Hope that helps!