Skip to content

Instantly share code, notes, and snippets.

@phillypb
Created December 18, 2018 20:07
Show Gist options
  • Select an option

  • Save phillypb/ae67b83777a5f11f9a9ca8146688d1c6 to your computer and use it in GitHub Desktop.

Select an option

Save phillypb/ae67b83777a5f11f9a9ca8146688d1c6 to your computer and use it in GitHub Desktop.
function splitUrlFile(Url) {
// remove this line when you incorporate into your script
var Url = 'https://drive.google.com/open?id=1ZvhkehvoL99EmmzUsy481givp31odMaO';
// split the Url via the equals sign to break into two
var split = Url.split('=');
// the file ID is the second part of the split (first part being zero)
var uploadID = split[1];
Logger.log('Upload file ID is: ' + uploadID);
// instruct DriveApp to open the file by its ID
var file = DriveApp.getFileById(uploadID);
Logger.log('File is: ' + file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment