google-apps-script

Google spreadsheet script export active sheet only to PDF

。_饼干妹妹 提交于 2021-01-29 13:15:36
问题 I created loop script for send email with PDF attachment. Loop function works correctly without any error. But email sent with attached PDF file shows all data of all sheets. I want to create PDF file only of ACTIVE sheet and not others. function SendInvoiceNew4() { var sheet = SpreadsheetApp.getActiveSheet(); // Loop from CELL Number Value to CELL Number Value EQUAL for(i=sheet.getRange("H11").getValue();i<=sheet.getRange("I11").getValue();i++) {// *************** Enter Start Invoice Serial

Using .getas to save a chart blob as an image gives Service Error in Google Script

柔情痞子 提交于 2021-01-29 13:05:11
问题 After creating a chart in google sheets I attempt to save that chart as and image. I am using .getAs('image/png'). I get service error: spreadsheet on this line. I have tried a variety of syntax from similar issues online and none are working. function CheckboxLogic() { var ws = SpreadsheetApp.getActiveSpreadsheet(); //Main worksheet ws.insertSheet('QuoteID'); //Create a new sheet using QuoteID for the name var ts = ws.getSheetByName('QuoteID'); //Target sheet //Create a chart from data

cloud platform project dialog box

拟墨画扇 提交于 2021-01-29 12:36:16
问题 I'm doing the basic tutorial for google Quickstart bot in section to part 2 I see: 2) In the Cloud Platform project dialog box, click the URL for the project associated with the script. I don't see any urls to click. Image of dialog box below 回答1: That's because since the release of April, 8th you can no longer view the default GCP assigned to your project (that is, if you created the project after the release). If properly reassigned a standard GCP, the link will appear in the dialog box in

Google Apps Script trigger execution too late

浪尽此生 提交于 2021-01-29 12:09:27
问题 I'm trying to trigger the execution of a function after like 1 second but google execute the function after 40 seconds or something 2 minutes. Here is my code function testFunc () { Logger.log("test called"); } function myFunction() { const now = Date.now(); const dateNow = new Date(Date.now()); const dateLater = new Date(now + 1000); const trigg = ScriptApp.newTrigger('testFunc') .timeBased() .inTimezone("Europe/Paris") // .at(dateLater) // 1sec .after(1000) // 1sec .create(); } I tried with

TypeError: Cannot call method “getRange” of null. (line 4, file “Code”

落爺英雄遲暮 提交于 2021-01-29 12:01:24
问题 I am trying to delete specific rows containing specific string "X". function deleteRows() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var s = ss.getSheetByName('delete containing'); var r = s.getRange('A:A'); var v = r.getValues(); for(var i=v.length-1;i>=0;i--) if(v[0,i]=='Substitution: ') s.deleteRow(i+1); }; But I am getting below error: TypeError: Cannot call method "getRange of null.(line 4, file "Code"). Can Anybody help me resolving this error? Thank you 回答1: From the

How to return the auto detected language from LanguageApp.translate?

安稳与你 提交于 2021-01-29 11:10:45
问题 I´d like to make an application which translates text to english (no matter which language is entered). The translation is already working pretty well, but now i´m trying to detect the language entered and i have no clue how to get the detected language from LanguageApp.translate. I tried using the google API but as it´s paid i need a opinion which is free as it´s a small project just for me and non commercial. var translatedText = LanguageApp.translate(sourceText, sourceLang, targetLang,

Issue with removing a library from Google Apps Script

≡放荡痞女 提交于 2021-01-29 11:10:29
问题 I deleted a version of a library, and now I'm getting the error "Library with identifier XXXXX is missing (perhaps it was deleted?)". I am also unable to remove the reference to the library. My code now won't run due to the aforementioned error. How can I resolve this? 回答1: I figured out how to accomplish this. 1. I need to be owner of the project that has the reference I'm trying to remove 2. Backup the code 3. In Script editor, open the project that has the reference I'm trying to remove 4.

Export Specific sheet to PDF [duplicate]

半城伤御伤魂 提交于 2021-01-29 10:57:32
问题 This question already has answers here : Export Single Sheet to PDF in Apps Script (2 answers) Closed 3 months ago . I am aware that similar type of question has being asked earlier under the Using Google Apps Script to save a single sheet from a spreadsheet as pdf in a specific folder The code that was used is working for me and is mentioned below: function generatePdf() { // Get active spreadsheet. var sourceSpreadsheet = SpreadsheetApp.getActive(); // Get active sheet. var sheets =

Google Form Upload files to specific new folder based on the value submitted

一个人想着一个人 提交于 2021-01-29 10:51:03
问题 I have form with 2 fields, lets say the name of the form is CV Drops Name Uploaded files button So, by default when people are uploading their files it will be keep in my Google Drive under folder CV Drops . What I wanted is that the files are placed inside subfolder based on their input in field NAME . How do I do that? 回答1: I believe your current situation and goal as follows. Your Google Form has 2 fields. Name Uploaded files button (In this case, multi files can be uploaded.) Both fields

get current thread id in gmail using google app script

荒凉一梦 提交于 2021-01-29 10:42:05
问题 I am building a Gmail Add-On. I want to get the thread Id of current open email thread using Google Apps Script. I tried to figure out in Google Developers documentation for GmailApp . But nothing found relevant. 回答1: You can retrieve messageId of the current message from e.messageMetadata.messageId of buildAddOn(e) . Using this, you can retrieve threadId as follows. var threadId = GmailApp.getMessageById(messageId).getThread().getId(); References : getMessageById() getThread() If this was