RcBuilder@walla.com
call centre: 054-5614020

Adwords scripts DriveApp

07
Jun
2014
Posted by: RcBuilder  /   Category: Adwords Scripts / DriveApp / JAVASCRIPT / SEM   /   1 Comment

Adwords scripts DriveApp

Google Drive for account files storage
allow you to add, update, find and manage files …

Methods
Folder addFile([file])
Folder addFolder([folder])
File createFile(blob)
File createFile([name], [content])
File createFile([name], [content], [mimeType])
Folder createFolder([name])
File getFileById([id])
File[] getFiles()
File[] getFilesByName([name])
File[] getFilesByType([mimeType])
Folder getFolderById([id])
Folder[] getFolders()
Folder[] getFoldersByName([name])
Folder getRootFolder()
int getStorageLimit()
int getStorageUsed()
File[] getTrashedFiles()
Folder[] getTrashedFolders()
Folder removeFile([file])
Folder removeFolder([folder])
File[] searchFiles([params])
Folder[] searchFolders([params])

USING
var FILE_NAME = ‘myFile1′;

var test_file = null;
var test_files_iterator = DriveApp.getFilesByName(FILE_NAME);

if(test_files_iterator.hasNext()) // file exists – get the first one
test_file = test_files_iterator.next();
else // no file in google drive – create it!
test_file = DriveApp.createFile(FILE_NAME, ‘HELLO FROM GOOGLE DRIVE’);

Logger.log(‘Id = ‘ + test_file.getId() + ‘\nContent = ‘ + test_file.getBlob().getDataAsString());

————————————————
// reset file
var FILE_NAME = ‘myfile’;

var file_to_reset = DriveApp.getFilesByName(FILE_NAME).next();
file_to_reset.setContent(‘ ‘);
DriveApp.removeFile(file_to_reset);

————————————————

var FILE_NAME = ‘myfile’;

var data_file = null;
var temp = DriveApp.getFilesByName(FILE_NAME);
var fileExists = temp.hasNext();

// first execution – create file at google drive
if(!fileExists) {
data_file = DriveApp.createFile(FILE_NAME, ‘ …. ‘);
return;
}

// file exists – read content
data_file = temp.next();
var content = data_file.getBlob().getDataAsString();

// code …

// update file
data_file.setContent(content);

Author Avatar

About the Author

בניית אתרים ופתרונות טכנולוגים | RcBuilder

1 Comment

  1. Javier August 4, 2014 at 11:03 am  /  Comment Reply

    I must point out my respect for your kindadness givading supadport to men who actuadally need help with your issue. Your speadcial comadmitadment to passading the soluadtion all-around has been unbeadlievadably good and have in most cases ebnelad women just like me to arrive at their aims. Your inforadmaadtive pubadliadcaadtion implies so much a peradson like me and a whole lot more to my office coladleagues. With thanks; from everyadone ofa0us.


  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים