google-apps-script,google-drive-sdk , No item with Given ID can be found


No item with Given ID can be found

Question:

Tag: google-apps-script,google-drive-sdk

I am having issues when running my script after the most recent API update. I had some issues that I was able to fix with some help from around here but now I am having a get by ID issue. I am unsure of where it is coming from because I have a few things that get by ID. Any help? Here is my code if you want to run it and a picture of what the error looks like.

If you want to run it you need to have a folder called Templates and a document inside of there. Inside of the document just needs to be {A} for column A in your spreadsheet and it should still give you that error, thanks!

enter image description here

function generateDocument(e) {
        var template = DriveApp.getFileById(e.parameter.Templates);
        Logger.log(template.getName());
        var Sheet = SpreadsheetApp.getActiveSpreadsheet();
        var row = Number(e.parameter.row) //+1; // Remove the // in this line next to the +1 to skip headers
        Logger.log(row);
        var currentFID = e.parameter.curFID;
        Logger.log(currentFID);
        var myDocID = template.makeCopy(Sheet.getRange('B' + row).getValue() + ' - ' + Sheet.getRange('E' + row).getValue() + ' - ' + Sheet.getRange('D' + row).getValue() + ' - ' + Sheet.getRange('X' + row).getValue()).getId();
        var myDoc = DocumentApp.openById(myDocID);
        var copyBody = myDoc.getActiveSection();
        var Sheet = SpreadsheetApp.getActiveSpreadsheet();
        //row--; // decrement row number to be in concordance with real row numbers in sheet
        var myRow = SpreadsheetApp.getActiveSpreadsheet().getRange(row + ":" + row);
        for (var i = 1; i < Sheet.getLastColumn() + 1; i++) {
            var myCell = myRow.getCell(1, i);
            copyBody.replaceText("{" + myCell.getA1Notation().replace(row, "") + "}", myCell.getValue());
        }
        myDoc.saveAndClose();
        var destFolder = DriveApp.getFolderById(currentFID);
        Logger.log(myDocID);
        var doc = DriveApp.getFileById(myDocID); // get the document again but using DriveApp this time...
        doc.addToFolder(destFolder); // add it to the desired folder
        doc.removeFromFolder(DriveApp.getRootFolder()); // I did it step by step to be more easy to follow
        var pdf = DriveApp.getFileById(myDocID).getAs("application/pdf");
        destFolder.createFile(pdf); // this will create the pdf file in your folder
        var app = UiApp.getActiveApplication();
        app.close();
        return app;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getTemplates() {
        var doc = SpreadsheetApp.getActiveSpreadsheet();
        var app = UiApp.createApplication().setTitle('Generate from template');
        // Create a grid with 3 text boxes and corresponding labels
        var grid = app.createGrid(5, 2);
        grid.setWidget(0, 0, app.createLabel('Template name:'));
        var list = app.createListBox();
        list.setName('Templates');
        grid.setWidget(0, 1, list);

        var folders = DriveApp.getFoldersByName("Templates");
        while (folders.hasNext()) 
        {
          var folder = folders.next();
          Logger.log(folder.getName());
          var allMyFilesByType = folder.getFilesByType(MimeType.GOOGLE_DOCS)
        };
        while (allMyFilesByType.hasNext())
        {
          var file = allMyFilesByType.next();
          list.addItem(file.getName());
          Logger.log(file.getName());
        };

        grid.setWidget(1, 0, app.createLabel('Row:'));
        var row = app.createTextBox().setName('row');
        row.setValue(SpreadsheetApp.getActiveSpreadsheet().getActiveRange().getRow());
        grid.setWidget(1, 1, row);
        var curFN = app.createTextBox().setText('MyDrive/').setName('curFN').setId('curFN').setWidth('400');
        var curFID = app.createTextBox().setText(DriveApp.getRootFolder().getId()).setName('curFID').setId('curFID').setVisible(false);
        var listF = app.createListBox().setName('listF').setId('listF').addItem('Please Select Folder', 'x');
        grid.setText(2, 0, 'Type Path:').setWidget(2, 1, curFN).setText(3, 0, 'OR').setText(4, 0, 'Choose Path:').setWidget(4, 1, listF).setWidget(3, 1, curFID);
        var folders = DriveApp.getRootFolder().getFolders();
        while (folders.hasNext()) {
            var folder = folders.next();
            listF.addItem(folder.getName(),folder.getId())
        };
        var handlerF = app.createServerHandler('folderSelect').addCallbackElement(grid);
        listF.addChangeHandler(handlerF);
        var panel = app.createVerticalPanel();
        panel.add(grid);
        var button = app.createButton('Submit');
        var handler = app.createServerClickHandler('generateDocument');
        handler.addCallbackElement(grid);
        button.addClickHandler(handler);
        // Add the button to the panel and the panel to the application, then display the application app in the Spreadsheet doc
        panel.add(button);
        app.add(panel);
        doc.show(app);
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function folderSelect(e) 
{
        var app = UiApp.getActiveApplication();
        var currentFN = e.parameter.curFN;
        var currentFID = e.parameter.listF;
        Logger.log(currentFID);
        var listF = app.getElementById('listF');
        var curFN = app.getElementById('curFN');
        var curFID = app.getElementById('curFID');
        if (currentFID == 'x') {
            currentFID = DriveApp.getRootFolder().getId();
            curFN.setText('MyDrive/')
        };
        var startFolder = DriveApp.getFolderById(currentFID);
        var folders = startFolder.getFolders();
        listF.clear().addItem('No More Sub Folders!', 'x').addItem('Go back to Root', 'x');
        if (folders.length > 0) {
            listF.clear();
            listF.addItem('Select Sub Folder', 'x')
        };
        while (folders.hasNext()) {
            var folder = folders.next();
            listF.addItem(folder.getName(),folder.getId())
        };
        curFN.setText(currentFN + DriveApp.getFolderById(currentFID).getName() + '/');
        if (currentFID == DriveApp.getRootFolder().getId()) {
            curFN.setText('MyDrive/')
        };
        curFID.setText(currentFID);
        return app;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function onOpen() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var menuEntries = [{
        name: "Export Row to Document",
        functionName: "getTemplates"
    }];
    ss.addMenu("Generate Documents Here!", menuEntries);
}

Answer:

problem is in this statement

var template = DriveApp.getFileById(e.parameter.Templates);

when you see the e.parameter.Templates name in logger it will be a file name. but DriveApp.getFileById will expect file id.

the above problem can be solved when you add file Id along with file name in

list.addItem(file.getName(),file.getId());

of getTemplates() method.

here is working code

function generateDocument(e) 
{
        //Logger.log(DriveApp.getFilesByName(e.parameter.Templates).);
        //SpreadsheetApp.getUi().alert(e.parameter.Templates);
        var template = DriveApp.getFileById(e.parameter.Templates);
        //Logger.log(e.parameter.Templates.getId());
        var Sheet = SpreadsheetApp.getActiveSpreadsheet();
        var row = Number(e.parameter.row) //+1; // Remove the // in this line next to the +1 to skip headers
        Logger.log(row);
        var currentFID = e.parameter.listF;
        Logger.log(currentFID);
        var myDocID = template.makeCopy(Sheet.getRange('B' + row).getValue() + ' - ' + Sheet.getRange('E' + row).getValue() + ' - ' + Sheet.getRange('D' + row).getValue() + ' - ' + Sheet.getRange('X' + row).getValue()).getId();
        var myDoc = DocumentApp.openById(myDocID);
        var copyBody = myDoc.getActiveSection();
        var Sheet = SpreadsheetApp.getActiveSpreadsheet();
        //row--; // decrement row number to be in concordance with real row numbers in sheet
        var myRow = SpreadsheetApp.getActiveSpreadsheet().getRange(row + ":" + row);
        for (var i = 1; i < Sheet.getLastColumn() + 1; i++) {
            var myCell = myRow.getCell(1, i);
            copyBody.replaceText("{" + myCell.getA1Notation().replace(row, "") + "}", myCell.getValue());
        }
        myDoc.saveAndClose();
        var destFolder = DriveApp.getFolderById(currentFID);
        Logger.log(myDocID);
        var doc = DriveApp.getFileById(myDocID); // get the document again but using DriveApp this time...

        destFolder.addFile(doc);//add to filder
        var pdf = DriveApp.getFileById(myDocID).getAs("application/pdf");
        destFolder.createFile(pdf); // this will create the pdf file in your folder
        var app = UiApp.getActiveApplication();
        app.close();
        return app;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getTemplates() 
{
        var doc = SpreadsheetApp.getActiveSpreadsheet();
        var app = UiApp.createApplication().setTitle('Generate from template');
        // Create a grid with 3 text boxes and corresponding labels
        var grid = app.createGrid(5, 2);
        grid.setWidget(0, 0, app.createLabel('Template name:'));
        var list = app.createListBox();
        list.setName('Templates');
        grid.setWidget(0, 1, list);

        var folders = DriveApp.getFoldersByName("Templates");
        while (folders.hasNext()) 
        {
          var folder = folders.next();
          Logger.log(folder.getName());
          var allMyFilesByType = folder.getFilesByType(MimeType.GOOGLE_DOCS)
        };
        while (allMyFilesByType.hasNext())
        {
          var file = allMyFilesByType.next();
          list.addItem(file.getName(),file.getId());
          Logger.log(file.getName());
        };

        grid.setWidget(1, 0, app.createLabel('Row:'));
        var row = app.createTextBox().setName('row');
        row.setValue(SpreadsheetApp.getActiveSpreadsheet().getActiveRange().getRow());
        grid.setWidget(1, 1, row);
        var curFN = app.createTextBox().setText('MyDrive/').setName('curFN').setId('curFN').setWidth('400');
        var curFID = app.createTextBox().setText(DriveApp.getRootFolder().getId()).setName('curFID').setId('curFID').setVisible(false);
        var listF = app.createListBox().setName('listF').setId('listF').addItem('Please Select Folder', 'x');
        grid.setText(2, 0, 'Type Path:').setWidget(2, 1, curFN).setText(3, 0, 'OR').setText(4, 0, 'Choose Path:').setWidget(4, 1, listF).setWidget(3, 1, curFID);
        var folders = DriveApp.getRootFolder().getFolders();
        while (folders.hasNext()) {
            var folder = folders.next();
            listF.addItem(folder.getName(),folder.getId())
        };
        var handlerF = app.createServerHandler('folderSelect').addCallbackElement(grid);
        listF.addChangeHandler(handlerF);
        var panel = app.createVerticalPanel();
        panel.add(grid);
        var button = app.createButton('Submit');
        var handler = app.createServerClickHandler('generateDocument');
        handler.addCallbackElement(grid);
        button.addClickHandler(handler);
        // Add the button to the panel and the panel to the application, then display the application app in the Spreadsheet doc
        panel.add(button);
        app.add(panel);
        doc.show(app);
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function folderSelect(e) 
{
        var app = UiApp.getActiveApplication();
        var currentFN = e.parameter.curFN;
        var currentFID = e.parameter.listF;
        Logger.log(currentFID);
        var listF = app.getElementById('listF');
        var curFN = app.getElementById('curFN');
        var curFID = app.getElementById('curFID');
        if (currentFID == 'x') {
            currentFID = DriveApp.getRootFolder().getId();
            curFN.setText('MyDrive/')
        };
        var startFolder = DriveApp.getFolderById(currentFID);
        var folders = startFolder.getFolders();
        listF.clear().addItem('No More Sub Folders!', 'x').addItem('Go back to Root', 'x');
        if (folders.length > 0)
        {
            listF.clear();
            listF.addItem('Select Sub Folder', 'x')
        };
        while (folders.hasNext()) 
        {
            var folder = folders.next();
            listF.addItem(folder.getName(),folder.getId())
        };
        curFN.setText(currentFN + DriveApp.getFolderById(currentFID).getName() + '/');
        if (currentFID == DriveApp.getRootFolder().getId()) {
            curFN.setText('MyDrive/')
        };
        curFID.setText(currentFID);
        return app;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function onOpen() 
{
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var menuEntries = [{
        name: "Export Row to Document",
        functionName: "getTemplates"
    }];
    ss.addMenu("Generate Documents Here!", menuEntries);
}

Related:


Google Apps Script: event.setTime error and time format


google-apps-script,google-spreadsheet,google-calendar
I'm creating something of a booking system which is nearly complete. Currently I'm collecting data from a form, passing it to a sheet, and then using some of that info to create a calendar event. This all works fine. On creating the event, I'm also collecting the eventID so that...

Calling FormApp within doGet(e) function


google-apps-script,google-form
I am relatively new to scripting, so please be kind. I am trying to create a function bound to a Form within Google Apps, including a webapp which captures 3 variables (requestNum, approverNum, and status) and obtains various other information from the FormApp (e.g titles, responses, etc). I am receiving...

Stylesheet for .html document not imported


google-apps-script
I have this form I created in HTML (called form.html) written in google apps script and I also have a stylesheet (CSS) to go with that. All is working well when I have the CSS in the same HTML-file as the form. However if I want to put my stylesheet...

Advanced Drive Services in Addons


google-apps-script,google-drive-sdk
I have a Google Script that uses the Advanced Drive API service and am now looking to convert this script into an Add-on. However the Drive API needs to be enabled manually by the user before using the service inside the Apps Script. Is it possible to use the advanced...

Google sheet app script errors after laptop sleep


google-apps-script,google-spreadsheet
I have a custom function in a sheet that calls a mysql database. It extracts one value from mysql per row, e.g. | A | B -------------------------------- 1 | YES | =readCompleteFromMember(A1) 2 | NO | =readCompleteFromMember(A2) If I let my laptop go to sleep and open it the next...

Google Spreadsheet custom function to add csv in spreadsheet


google-apps-script,google-spreadsheet,google-spreadsheet-api
I am using Google spreadsheets, and in my google spreadsheet i want to import data from my RESTful web service. I cant use =IMPORTDATA due to the fact that i need to add a header to the url for auth purposes. This is the custom function i have so far:...

Google Sheets Adds-on open automatically when user opens a sheet or clicks a link in worksheet


google-apps-script,google-spreadsheet
I created an google sheets add-on. However, it is a bit hidden in the adds-on menu. Is there a way to enable the Adds-on automatically when user opens a sheet or when user clicks a link in a sheet? I searched on Google Sheets documentation but found nothing. EDIT1: Since...

getJSON from Google Apps Script not working in Safari


google-apps-script,safari,getjson
I've created this piece of code to handle my user login. var gasUrl = "https://script.google.com/macros/s/[my id]/exec"; function submitFormData() { var username = $("#inputEmail").val(); var password = $("#inputPassword").val(); $.getJSON(gasUrl + "?username=" + username + "&password=" + password, function(data) { if(data[0]) { localStorage.setItem("username", data[0].username); localStorage.setItem("id", data[0].id); window.location.href = "/index.php"; } else {...

Constantly getting an email: Cannot read property “0” from undefined


javascript,google-apps-script,gmail
I am constantly getting emails from "me" with this in it: Cannot read property "0" from undefined. I think it has something to do with Google Apps script because it started when I tried to code something. (for details: I was trying to code a "Contact Us Form" for my...

Javascript (Google Scripts) value from a function is not returning


javascript,google-apps-script,google-spreadsheet,google-calendar
I think could be a simple one to solve, I am stuck working this simple issue out. I have called a createEvent function to create a google calendar event. As part of this function I also get the google calendar event ID as EventId and want to return it. For...

How to prevent Google Forms from converting form input to scientific notation format


javascript,google-apps-script,google-docs,google-form
I have a simple script set up that sends emails based on Google form entries using a script-based VLookup to get the contact emails. In some cases, Google Forms converts longer numbers entered into the form field to scientific notation. A workaround I have been using is to enter an...

Google Scripts + Google API PHP


php,google-apps-script,google-api,google-apps,google-api-php-client
I am trying to call one of my Google Scripts from my google-api-php-client and I can't find how to do this. I deployed my app as a web app, and I got the web app url which I can call with curl, but I need to call it as my...

How can I make a copy of a file in Google Drive via Python?


python,google-drive-sdk,google-oauth
I wrote a short function in Google Apps script that can make a copy of a specific file that is stored on Google Drive. The purpose of it is that this file is a template and every time I want to create a new document for work I make a...

Running Apps Script from Chrome extension requires authorization


google-chrome-extension,google-apps-script
I'm trying to execute a Google Apps Script from an event on my Chrome extension. While it works great, when ran for the first time by a new user, the apps script requires for the user to give it authorization before it can execute. The problem is when running the...

Output API data to a csv file


google-apps-script
I have Frankenstined bits of code together found on here and on various Google tutorials. My goal is to get data from the Google Analytics API and output it to a file in my Google Drive "my_data.csv". I am able to get my data from the GA API in a...

SpreadsheetApp.getActiveSpreadsheet() is breaking script


google-apps-script,google-spreadsheet
I'm writing my 1st google app script. Spreadsheet opens a sidebar in onOpen(). Sidebar has Button and in SidebarJavaScript.html I have listener to that button. I'm calling SpreadsheetApp.getActiveSpreadsheet() inside listener and after this line script is not executing. What could possibly be wrong here? function onScrapeClick(){ // Disable Button this.disabled...

Google spreadsheet script authorisation to BigQuery


google-apps-script,google-spreadsheet,google-bigquery
I have a Google spreadsheet with a script that connects to BigQuery (using this tutorial - https://developers.google.com/apps-script/advanced/bigquery?hl=ar-AE). It adds an extra menu option and users can run the script that executes a query to BigQuery. It works fine for me and I want to share this spreadsheet with other users...

Can one track the usage of a shared resource from google drive


google-drive-sdk
Does anyone here know if you on Google Drive somehow can track if a public shared link to a file have been used? That is, the resource have been downloaded, viewed or otherwise "touched"?...

Directory sandboxed access for Google Drive / Dropbox API / RemoteStorage apps?


html5,google-drive-sdk,dropbox-api
Is there a way to get sandboxed, user-selected directory access on any major file service without first getting read level access to their entire filesystem? There's a lot of talk about "unhosted" static webapps that allow users to access their data from a 3rd party file service (Google Drive, Dropbox,...

How can I exclude a sheet in an array, and sort with a range


google-apps-script,google-spreadsheet
Good Morning everyone I have a code that was posted here a while back, I recently started using for a google spreadsheet and tweaked it a bit, how ever there are 2 thigs I have not been able to accomplish the first thing is to Exclude the Master sheet from...

Google Drive API (GTL) - Create multiple folder paths in order?


ios,objective-c,swift,google-drive-sdk,google-api-objc-client
I'm using the Google APIs Client Library for Objective-C (GTL) to access the Google Drive API. According to it's Introduction to the Google APIs Client Library for Objective-C, Query execution by the service is inherently asynchronous. Which means when you try to create a path like: root/a/b/c, before you can...

Function to check for first blank cell


javascript,loops,google-apps-script,google-spreadsheet
so, I'm attempting to define a custom function that returns the row number of the first blank cell it finds within a custom range. function checkForBlank(startRow,startCol) { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var checkRow = startRow; var checkCol = startCol; var range = sheet.getRange(checkRow, checkCol); var i...

Access dropdown items in Google App Scripts UiApp


google-apps-script,listbox
I'm using the older depreciated UiApp class in javascript (because I have to) where I have a dropdown list I need to access the ListBox, and see all the values that it contains. Is there a way to do this? All the items must be present because there is method...

Google Drive API VB.NET Parent Folder of a Folder


vb.net,google-drive-sdk,folder,parent
I am trying to work with Google Drive API with vb.net I have seen a lot of post but I am not able to understand how to choose the right folder to add a file. I have a lot of "Backup" folder but, I assume now, I want to add...

Publish a Spreadsheet Add-on in the Chrome Store


google-apps-script,google-apps,google-apps-marketplace
I'm trying to publish a Spreadsheet Add-on following the the app scripts documentation but I get this error: Please fix the following errors: API Console project with the id specified in the manifest's api_console_project_id field, does not have Google Apps Marketplace SDK enabled. api_console_project_id Here you can see a screenshot:...

Google Spreadsheet setBackgroundColors() “Deprecated”


google-apps-script,google-spreadsheet
A gs I have been using in the past to check for duplicates, is no longer working. The script would check all cells in the spread sheet if any were identical it would highlight all their occurrences green. I also had another function that would revert all the cells back...

Delete or Trash specific file in Drive


google-apps-script
I had a script that ran every day at 5 am, that would move a specific file (data.xls) to the trash. However, since DocsList has been retired, the script no longer functions, and I'm having trouble updating it. I've seen a couple of delete/setTrashed scripts posted here, but they all...

Insert file using Google Drive API?


java,google-drive-sdk
Based on Google Drive API reference guiding how to insert file Files.insert // File's metadata. File body = new File(); body.setTitle(title); body.setDescription(description); body.setMimeType(mimeType); // File's content. java.io.File fileContent = new java.io.File(filename); FileContent mediaContent = new FileContent(mimeType, fileContent); try { File file = service.files().insert(body, mediaContent).execute(); // Uncomment the following line to...

How to get the last entry containing a certain value in Google Spreadsheet


google-apps-script,google-spreadsheet,google-form,formulas
I have an answer spreadsheet linked to a Google form. I wish to get the last date that and answer was submitted. Lets say I my entries look like this : DATA : A B 1 Date String 2 2015-05-09 Abb 3 2015-05-11 Bcc 4 2015-05-12 Cdd 5 2015-05-20 Bcc...

Google Apps Script return array values and use them in a javascript function


javascript,arrays,google-apps-script
I am trying return an array and use it in a javascript function, but it doesn't seem to work. My Code.gs is as follows: function doGet() { return HtmlService.createHtmlOutputFromFile('test') .setSandboxMode(HtmlService.SandboxMode.IFRAME); } function test() { var locations = []; var ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/13q7pIeMUHll6_5xBUpBavaBqALt9fnFnOIO-Hwy_pFc/edit'), sheet = ss.getActiveSheet(), range = ss.getRange("D2:D4"), values =...

Script for Gmail label to Sheets


google-apps-script,gmail
I am trying to make a script that takes an email within a certain label and puts it into google sheets. Im using this function at the moment: function getMessagesWithLabel() { var destArray = new Array(); var threads = GmailApp.getUserLabelByName('Facebook').getThreads(0,10); for(var n in threads){ var msg = threads[n].getMessages(); var destArrayRow...

DriveApp.getFolderById Permissions


google-apps-script
I'm trying to "upgrade" an old script from DocsList to DriveApp and having a problem with a getFolderById call. The script had worked previously using DocsList.getFolder. I have a (previously-created) folder named "Email Archive" that I'm trying to access in script. Through using Logs and Execution Transcript, I've verified that...

401 Unauthorized - Google Drive API


asp.net,.net,vb.net,google-drive-sdk
I'm working with the Google APIs for the first time and I'm having problems trying to download files with the File object "downloadUrl" property. I'm currently using the "Service Account" option with the associated service account email and P12 certificate. However, the URL returned "https://doc-08-68-docs.googleusercontent.com/docs/securesc/bteg36c1tifegg79l2ov17og25612tet/gk7kn52ahe4d0to7d6hte9f0f2hv47e4/1434132000000/11750183130219432819/11750183130219432819/0BziIKv2_NWCxc3RhcnRlcl9maWxl?e=download&gd=true" returns a 401 - Unauthorized...

Break Google Apps HTMLService Page into multiple .html files


google-apps-script,google-apps
I want to combine a few related HTMLService interface in to a tabbed page. I can get the tabs working using the code here. But I want to put the page for each Tab into a different html file in the project. How would I show Billets.html inside the div...

Pass webapp link parameter to html file in Google Apps Script


google-apps-script
I am trying to pass a parameter from a webapp link, so it can be used to pre-fill an html form (using HtmlService). Apps Script - function doGet(e) { var formId = e.parameter.formId; return HtmlService.createTemplateFromFile('Index') .id = formId .evaluate() .setSandboxMode(HtmlService.SandboxMode.IFRAME) } Index.html - <form id="myForm"> <input type="text" name="formId" value="<?=id?>"><br> <input...

Google Sheets API for clickable images in Google Sheets


google-apps-script,google-spreadsheet,google-spreadsheet-api,google-spreadsheet-addons
In Google sheets, you can insert a clickable image to a cell which links to a function in app script. Can we also insert this clickable image and link it to app script from our server using Google Spreadsheet API? Or Can we call app script from our server? https://developers.google.com/apps-script/guides/menus#clickable_images_and_drawings_in_google_sheets...

How to real-time monitor the emails?


api,google-apps-script,gmail,quota
Good day! I want to offer the implementation of google apps to my company. Also we have a need to reply on messages, that we recieve through our web-site in 10 minutes time limit. For this purpose our big team of sales managers a handling emails when they have a...

Script to check for email subject not in inbox runs without error but not as expected. Not sure what is wrong with syntax.


google-apps-script
I get an automated email when an event occurs, but need to be notified if it isn't received. It's easy to overlook something that doesn't happen. Here's what I have, but the var c remains 0 when script ends (I'm expecting it to not be 0 if email is found,...

Get column to display month name Google App Script


google-apps-script
How do I set a column to display the name of the month instead of the whole date using the script? The function can manually be performed by selecting Format>Number>August in the menu but I want to do this in code. This is what I've tried but I can't seem...

Google Form to Document Merge to Pdf to Mail


google-apps-script,google-spreadsheet
I think my issue is in the e.values I am using along with the ('keyXXXXX', XXXXX); that I am using. The original code I used was something I borrowed from TJ Houston's site. I am using it for an application process. I wrote the code following the process of using...

Merging Multiple Arrays Evenly/Alternating with Javascript and Google AppScript


javascript,arrays,google-apps-script,merge
I'm trying to merge multiple arrays evenly/alternating in javascript/Google appScript. There are several arrays (5 or 6). I've tried 2 different methods, but neither worked. I don't work a lot with javascript honestly and I've managed to get the code to this point, but I can't get it merge properly;...

Output Google Spreadsheet to XML/RSS/Atom using Google AppScript Content Service


xml,google-apps-script,rss,google-spreadsheet,google-docs
So I've searched this site and found nothing really useful so far to accomplish this. I am wanting to turn a spreadsheet into an RSS feed using google script content service. How do I declare column values (i.e. pubDate, Author, Content) so it will output correct RSS/Atom feed. Following their...

Google Apps Script - Sharing outside of domain


google-apps-script,google-form
So I have followed the tutorial here, and everything works great... for me. google forms file upload complete example What I need to do is add the script to a Google Form, and allow users to upload an image along with the form. I know it will only put it...

Google Drive API 500 null errors when copying


google-api,google-drive-sdk,google-api-php-client,google-api-client
I'm getting this error message (100% of the time) when copying a shared file, using the latest version of php library. And I'm getting the same response via the API explorer: developers.google.com/drive/v2/reference/files/copy Google_Exception: Error calling POST https://www.googleapis.com/drive/v2/files/#fileid#/copy: (500) { "error": { "code": 500, "message": null } } This issue seem...

Google Calendar: How to check guest is not busy and available to book through google calendar


google-apps-script,google-api,google-calendar
I am exploring to write google calendar api integration through google scripts or apis. Is there a way I can check a guest is available before I book an event ?...

Google Spreadsheet (Using named range in script)


google-apps-script,google-spreadsheet
Trying to get my script to use a named range. In that range I am trying to reset the cell colors back to white. I keep getting an object error, can't figure out how to make this work. function resetCheckDirectory() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var tableRange = ss.getRangeByName("rangename"); tableRange.setBackgrounds("#FFF");...

How to remove quote mark from array


javascript,google-apps-script
I have a script that will import data from a csv file in to a Google sheet. I would like to include the following to remove the quote marks from the data - .replace(/"/g, "") - but am not sure of the best place/syntax to add in to the existing...

How to implement rangeProtect() over multiple tabs - google spreadsheet


function,google-apps-script,google-spreadsheet,spreadsheet
I'd like to implement a script to implement range protections on the different tabs of the spreadsheet when someone create a new spreadsheet by copying my template. The issue I encounter is when the script run through the protection implementation. My code seems to be fine as per the debug...

Search for value in variable Google Apps Script/JS


javascript,google-apps-script,google-calendar
Trying to determine if calendar events in Google Calendar were created by the user himself or if a CSV bulk upload was performed. If the script finds an ID with "CSV" somewhere in the value, then remove it. I tried to add an if statement where it looks at the...