google-sheets

Only get non-filtered values for Google App Script getRange using isRowHiddenByFilter or isRowHiddenByUser

别等时光非礼了梦想. 提交于 2021-01-29 13:47:12
问题 I'm fairly new, trying to do the same thing as Only get non-filtered values for Google App Script getRange - get all rows that aren't hidden without using an added column. Make it generic so that regardless of what fields were used to hide rows, I'll only be acting on the non-hidden. I've been playing with isRowHiddenByFilter() and isRowHiddenByUser() but not getting it. To get all unfiltered rows, would I need to check that isRowHiddenByFilter() and isRowHiddenByUser() are both false? It

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

Google Sheets: Query where date>now() returns nothing

走远了吗. 提交于 2021-01-29 12:31:25
问题 I am using Google Sheets query function to bring data from a different sheet. This query works perfectly, matching two text fields (Where A='"&A5&"') =query('Modifications'!$A$3:$I,"Select E,F,G,H,I Where A='"&A5&"'order by E desc limit 1") However, when I try to add an AND statement as part of the Where clause to filter by today's date ( now() ), the query returns nothing: =query('Modifications'!$A$3:$I,"Select E,F,G,H,I Where A='"&A5&"' AND F>now() order by E desc limit 1") What am I

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

Import table using IMPORTXML

点点圈 提交于 2021-01-29 10:59:23
问题 I am trying to pull the table from https://rotogrinders.com/schedules/nfl into Google Sheets I tried using ImportHTML("https://rotogrinders.com/schedules/nfl", "table", 1) but it just returns the header: Time Team Opponent Line Moneyline Over/Under Projected Points Projected Points Change Using ImportXML, I tried IMportXML("https://rotogrinders.com/schedules/nfl","//tr"), but it returns the same header and no data. I dont think the tbody needs authentication to access. I logged out, cleared

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 =

copyTo(destination, copyPasteType, transposed) stops rest of function from executing

社会主义新天地 提交于 2021-01-29 10:35:16
问题 I'm trying to use the function copyTo(destination, copyPasteType, transposed) to copy a sheet in one file to another sheet in a different file while keeping everything, including column width, the same. Using just the function copyTo(destination) , my code works and I get everything I want in a different file, EXCEPT the column width. However, when I try and use copyTo with the copyPasteType argument, the sheet is copied perfectly (with the correct column widths), BUT any subsequent code isn

Sending only one sheet or active sheet as pdf via email

孤者浪人 提交于 2021-01-29 10:31:06
问题 Hello I have been trying to write my first script to send just one of the sheet from one of my google document but everytime I end up sending all the sheets instead. The document has a main page daily where i have the list of emails and then 7 sheets called monday, tuesday, etc This is the code i use - can you help? function emailActivesheetAsPDF() { DocumentApp.getActiveDocument(); DriveApp.getFiles(); const ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1

Variant Array Custom Function Google Sheets? VBA For Example

99封情书 提交于 2021-01-29 10:30:26
问题 The following function below will add "1" to every column across the excel sheet. If I put =vbe(12) in A1, it will put "1" in columns "A1:L1". How can I translate this VBA to JavaScript for Google Sheets? Function vbe(Num As Long) As Variant Dim ary As Variant Dim i As Long ReDim ary(Num - 1) For i = 0 To Num - 1 ary(i) = 1 Next i vbe = ary End Function 回答1: You can write a custom formula that creates an array of "1"s with the length as a specified parameter, e.g. function myFunction