google-apps-script

Share a Google App Script to other users - permission requested & authorize script

女生的网名这么多〃 提交于 2020-08-27 09:02:16
问题 I've created a spreadsheet with some GAS behind it that opens a form with some inputs, and now I need to deploy the webapp and share it to some other users. The problem is that when the other users try to open the spreadsheet (shared in Google Drive), they get this error message: I've already tried to: Share the spreadsheet to the user/s (Adding the user/s email address with permission Can edit ) Deploy the webapp settings with the following settings: As you can see, the setting screen

How find location of cell with some value

人走茶凉 提交于 2020-08-26 12:48:32
问题 I need to find a row in my spreadsheet that contains some data and delete it. all I know is the id inside a cell on the row. How can I perform a search for the location of the cell with google REST API Like for example: GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:find?value=123456 response: sheet1! B2:B2 Also: I also want to support cut&paste from one sheet to another. so put metadata on the row can't work because it lost when copying cells from the row to another

How find location of cell with some value

人盡茶涼 提交于 2020-08-26 12:46:47
问题 I need to find a row in my spreadsheet that contains some data and delete it. all I know is the id inside a cell on the row. How can I perform a search for the location of the cell with google REST API Like for example: GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:find?value=123456 response: sheet1! B2:B2 Also: I also want to support cut&paste from one sheet to another. so put metadata on the row can't work because it lost when copying cells from the row to another

Google Script App Fails in Incognito Mode

穿精又带淫゛_ 提交于 2020-08-26 11:34:34
问题 I have a simple Google Script published as a web app with anonymous access. The code is available here and the web app is available here. code.gs function doGet() { return HtmlService.createHtmlOutputFromFile("index").setTitle("Google Script") } index.html <!DOCTYPE html> <html> <head> <base target="_top"> </head> <body> <p>Hello</p> </body> </html> The script web app works in normal Chrome mode but returns a 500 error when the page is viewed in the incognito mode of Chrome or Firefox. The

Why Class Range getValues sometimes returns [[]] when chained to Class Sheet getActiveRange?

隐身守侯 提交于 2020-08-26 10:35:26
问题 Tl;Dr. Is a good practice chaining getValues() to Class Sheet getActiveRange() ? What could cause that sometimes returns [[]] instead of the expected values? NOTE: [[]] is what is being displayed in the Log / Script executions page. These "things" doesn't show quotation characters for strings. This is derived from Get selected values in row where I posted an answer with a couple of alternatives to get the values of the active range. Here I'm specifically asking for the reasons of the randomly

How to call library function as custom function from spreadsheet formula?

生来就可爱ヽ(ⅴ<●) 提交于 2020-08-26 09:47:25
问题 This might be the same root cause as in How to call a library function from a spreadsheet drop-down menu generated by the same library, but I still wanted to throw it out there in case there was something new or somehow the situation was different. The thing is that I want to keep all my custom functions in a library, then add the library to any given spreadsheet, and be able to reference them from a cell formula. In the library: /** * Returns the parameter * Eg: (16) to 16 * * @param {object

Google Apps Script getWidth() for document table cell width returns null

杀马特。学长 韩版系。学妹 提交于 2020-08-26 07:43:29
问题 I'd like to insert image in the Google document by using Google Apps Script, and to spread it (the image) to the width of the page - margins or to insert it in the table cell and spread it to the width of the cell. The code goes like this: var image = DriveApp.getFileById(fileId).getBlob(); var insertPlace = body.findText(searchText).getElement(); insertPlace.asText().setText(""); var insertedImage = insertPlace.getParent().asParagraph().insertInlineImage(0, image); var h = insertedImage

How to get the table width

眉间皱痕 提交于 2020-08-26 07:24:10
问题 I want to get the width of a table in Google Documents. The following screenshot shows a demo document. It has only a table having one row which has only one cell. The table was added by clicking on Insert > Table and then on the option to insert a table with a single row and single cell. The table was not manipulated after being inserted. In the Class Table from the Google Apps Script Class Table it hasn't a method to get the width, the Class Row either, but the Class Cell has getWidth() ,

Move multiple rows at once with multiple conditions

血红的双手。 提交于 2020-08-26 07:10:28
问题 I want to iterate through each row at once with the for loop. When the row has the value "Done" in column P and "Update" in column M, I want to move the row to Done Sheet, if the row just has "Done" in P, I want it to move to Control Sheet. function done() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var s = ss.getActiveSheet(); var numColumns = s.getLastColumn(); for(var i = 1; i < 50; i++) { var cP = s.getRange(i, 13).getValue(); var cM = s.getRange(i, 10).getValue(); if (cP == "Done"

How To Use Appscript doPost to create a REST API?

天涯浪子 提交于 2020-08-25 07:56:22
问题 After 1 month, I would like to open the question regarding this topic once again: Here is the whole post with all links: https://docs.google.com/document/d/1Tb0-twzHl-wXbvaNF2IpCT0CiONT9PoqPlEweLz3oYI/edit There is a function in a project in which a urlFetchApp sends payload, using doPost in the second script function. The second function stores the payload in the 1. spreadsheet: When running the first function, the second function does not store the payload in the spreadsheet. Detailed