google-apps-script

Is cell edit history accessible programmatically in Google Apps Script?

好久不见. 提交于 2021-01-29 05:54:58
问题 In have an installed trigger for onEdit and an installed trigger for onChange. I log the contents of the event object that is passed in as below function installedOnChange(e) { var me = CalleeName(arguments); Logger.log("%s: %s", me, JSON.stringify(e)); (CalleeName is defined as function CalleeName(a) { return a.callee.toString().split(" ")[1].split("(")[0].trim(); } ). The stringification of the event contains .oldvalue and .value except in the situation where a cell is ^C copied and then ^V

Google Script: Updating a Single Cell with an IMPORTDATA Formula

北战南征 提交于 2021-01-29 05:44:54
问题 I have a single IMPORTDATA formula in Cell A1 of a Google Sheet named "test-r" that I would like to be able to update the cell on a specific interval -- anywhere from seconds to hours. After a good amount of research, I landed upon this suggestion in a previous post, but I am not having much success with it. Here is how I modified the script in that post for my IMPORTDATA formula in Cell A1 of my sheet/tab name of "test-r" function forceEval(sheetName, Row, Col){ var ss = SpreadsheetApp

Google Scripts seems to be Caching Cell Values - Any way to avoid?

落花浮王杯 提交于 2021-01-29 05:37:06
问题 Hello Stack Overlords! I'm currently trying to put together a little coding project. Something simple, but I'm having a rather difficult time. The objective, clear out three cells once the time of day, based on one of those cells, passes. Essentially - G9 contains the the time I want the cells to be cleared. Once it has gone past the time of day specified in G9, I'd like cells D6, D9 and G9 cleared. I've set up a way of doing this using an IF statement, both from the sheets side, and scripts

Installable trigger created using “ScriptApp.newTrigger” has to be re-saved before it will run

僤鯓⒐⒋嵵緔 提交于 2021-01-29 05:20:11
问题 I have an Expenses sheet that I copy to the Google Drive folder for each of my relevant users. Each copy of the sheet needs an installable trigger that calls a function to insert additional rows when the last row of data gets edited. These are triggered using the onEdit event. The installable triggers work fine when created manually (via " Edit Current Project's triggers "). To simplify the process of setting up new users, I have scripted the creation of my trigger. Although the script

Convert a text string to a formula in a spreadsheet

别等时光非礼了梦想. 提交于 2021-01-29 04:54:09
问题 I'm trying to develop an interactive spreadsheet that creates a narrative for a budget document. There will be a variety of options. Once the user selects an item, it will help them calculate the total. I want to setup option boxes that they fill in. For example, four cells will be allowed for input B1:B4. I am going to name each of the four cells (i.e. A, B, C, D). In the reference document I want to write various formulas. In some cases I might need "(A+B)*C" in another I might need "A * B

Convert a text string to a formula in a spreadsheet

主宰稳场 提交于 2021-01-29 04:52:21
问题 I'm trying to develop an interactive spreadsheet that creates a narrative for a budget document. There will be a variety of options. Once the user selects an item, it will help them calculate the total. I want to setup option boxes that they fill in. For example, four cells will be allowed for input B1:B4. I am going to name each of the four cells (i.e. A, B, C, D). In the reference document I want to write various formulas. In some cases I might need "(A+B)*C" in another I might need "A * B

Adding a chart in Google Sheets with Google Script

旧城冷巷雨未停 提交于 2021-01-29 04:30:45
问题 I'm trying to add a chart in a sheet on Google Sheets but Google Script is saying "Cannot find method insertChart(Charts.Chart). (line 39, file "Code")". But I'm using the method that written in the documentation. What am I doing wrong ? function doGet() { var app = SpreadsheetApp; var ss = app.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); // var artistsArray; var dataArtists; // artists = {}; dataArtists = Charts.newDataTable() .addColumn(Charts.ColumnType.STRING, 'Artists')

Doesn't sheet.isRowHiddenByFilter(n) work with slicers?

耗尽温柔 提交于 2021-01-29 04:12:33
问题 I am trying to use a script to do something to only the rows that are not filtered when using slicers in Google Sheets. I can't get it to work. I have tried this: Logger.log(SpreadsheetApp.getActiveSheet().isRowHiddenByFilter(1)); I get "false" even if the row is hidden by using a slicer (new feature in Google Sheets). Anyone got it to work? Edit: It works with regular filters, grammar, edited row number in function parameter. Replaced the phrase filter control (direct translation from

How to set a border around an image in a Doc using Google Apps Script?

自作多情 提交于 2021-01-29 03:52:49
问题 I'm trying to find a way to get a border around an image in Google Docs using Google Apps Script. This is possible in the GUI of Google Docs but I can't find how to do this using the GAS. I've tried using style attributes but these don't seem to affect the image at all. (https://developers.google.com/apps-script/reference/document/text#setattributesattributes) Video of what I want to do: https://www.youtube.com/watch?v=FC2wpheln_o Any help would be welcome! 来源: https://stackoverflow.com

Google Sheets: Import folder range into Master Sheet

老子叫甜甜 提交于 2021-01-29 03:50:51
问题 I'm looking to import rows from spreadsheets in a source folder that will be updated daily with new spreadsheets. Is it possible to pull a specific range from every new spreadsheet in the source folder into a Master Sheet? I've been using the following code from an answer to a similar question here. This works perfectly except it duplicates the data that has already been imported to the Master Sheet. How can I fix this? function getdata() { //declare multiple variables in one statement -