google-apps-script

Google Apps Script Header/Footer Clear and Replace

被刻印的时光 ゝ 提交于 2021-02-16 15:17:09
问题 I have a script that updates Google Docs' header and footer (by retrieving parameters from the AODocs add-on) when a new document version is published. My problem is that the footer.clear() method doesn't seem to erase the header (or footer) and leaves a carriage return at the top of the section. Subsequent versions keep "growing" in the footer space. Is this a known issue? Am I doing it wrong? (I pull in a line from a template so that I can have pagination, too. Here's a code-snippet for the

How to add a simple calculated field to a google form?

做~自己de王妃 提交于 2021-02-16 09:57:05
问题 I'm looking for a way to add simple calculated field in a google form that will be dependent on other field's values. The first field is a simple price field quantity * price = total_price where quantity is a numeric field entered by the user. The second field is an end date now() + X months where X is selected by the user. I'v taken a look at google's tutorials and found only addons which in my understanding are form wide where i'm looking for something more like a custom form field. The

Can I use scripts alongside or in reference to an Add-on's functions in Google Sheet?

不打扰是莪最后的温柔 提交于 2021-02-15 07:54:58
问题 I've created a Google Sheet in which I am using the Autocrat Add-on. I've created a script that takes further actions that I would like to triggered by onFormSubmit(). What I notice is that if I run the script in the Script Editor, it executes fine and takes the actions on the spreadsheet that I want it to successfully. When I submit a new entry on the form, however, it doesn't run the script - regardless of whether Autocrat is configured to take action onFormSubmit() or not. (This

find this error in my code TypeError: Cannot read property 'getLastRow' of null (line 5, file “Code”)

点点圈 提交于 2021-02-15 07:48:08
问题 function prices() { var scraperSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("prices") var lrow = scraperSheet.getLastRow(); for (var i=2;i<=lrow;i++) { var regEx = /<span id="priceblock_dealprice.*<\/span>/gi var getContent = UrlFetchApp.fetch("https://www.amazon.in/"+scraperSheet.getRange(i,1).getValue()).getContentText().trim(); var price = getContent.match(regEx) price = price[0]; price = price.replace('<span id="priceblock_dealprice" class="a-size-medium a-color-price

How to get a list of G Suite users which are using Google Apps Script?

安稳与你 提交于 2021-02-15 07:47:33
问题 I would like to find out, is there any chance to get a list of G Suite users (of one domain) who are using Google Apps Script? 回答1: After you retrieve the list of script projects from Google Drives of your users, you will have to first request project metadata for them from the Apps Script API. Presently, the only way to get a project is to go one by one, supplying requests with scriptId . The trick is that the Id of the script project file happens to be the the same as script Id (if you look

Google script - using template to build table

匆匆过客 提交于 2021-02-15 07:44:29
问题 Trying to build a report to be sent via email. My idea was to build the email using an HTML template, but I seem to be missing out on something... The email should contain a report which will include all entries with a specific month in ColB. Here's a quick demo sheet Here's my code function MonthlyPulseCheck() { var spreadsheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet1'); var pulsedate = new Date("02/02/2022"); var pulsemonth = pulsedate.getMonth(); var Pulsetable =

Google script - using template to build table

一笑奈何 提交于 2021-02-15 07:44:00
问题 Trying to build a report to be sent via email. My idea was to build the email using an HTML template, but I seem to be missing out on something... The email should contain a report which will include all entries with a specific month in ColB. Here's a quick demo sheet Here's my code function MonthlyPulseCheck() { var spreadsheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet1'); var pulsedate = new Date("02/02/2022"); var pulsemonth = pulsedate.getMonth(); var Pulsetable =

Escape regex literal in Google Apps Script

≡放荡痞女 提交于 2021-02-15 05:09:30
问题 I have no idea why this isn't working - I've put it through one of the better regex tools I've found on the web to verify it, and I'm using what seems to be the escape character '\' before the + sign to make it a literal '+', but Google Scripts keeps complaining saying "Invalid Quantifier '+'" (Line 2) Here's my script, with certain personal details (it's to clean out email as I use this account as a hard spam filter) omitted: function getEmailData() { var find_email_regex = new RegExp(

Hiding worksheets from specific users inside a spreadsheet

白昼怎懂夜的黑 提交于 2021-02-13 17:32:20
问题 Sorry I'm not familiar with coding, I have a spreadsheet with multiple worksheets, it's shared with many people, I'm trying to make those sheets hidden by defaults when it's shared with a new person, and define some users as an admin users, and user groups for each location, I could run the code, and it worked when it was shorter, I know there might be easiest ways, however do you beilive there is a speific reason I'm getting nothing running the code, and users still see the hidden sheets

Google Sheets - Run script with Sheet Protection

陌路散爱 提交于 2021-02-13 17:31:35
问题 I'm having an issue with my google sheet. Everything works fine on the owner view, but when I tried to share it to an editor, some function didn't go as I planned. As an owner, I use the protected sheets and ranges function. So, I used the protect sheet, then the except certain cells function so that editors can edit within that range. I put a two buttons to hide (for the rows that is empty) and show rows. The script is working fine since it worked on the owner view, but when I opened it to