google-apps-script

How to change only the *selected* text to uppercase, not the entire paragraph in which the selection exists

喜欢而已 提交于 2021-02-08 08:24:05
问题 In Google docs, this function changes the selected text to black function selectedFontColorBlack() { // DocumentApp.getUi().alert('selectedFontColorBlack'); var sel = DocumentApp.getActiveDocument().getSelection(); var elements = sel.getRangeElements(); for (var i = 0; i < elements.length; i++) { var element = elements[i]; // Only modify elements that can be edited as text; skip images and other non-text elements. if(element.getElement().editAsText) { var text = element.getElement()

Generate 'n' unique random number within a range

百般思念 提交于 2021-02-08 08:20:34
问题 I need to generate 5 random number within a specific range from 1 to 100 with out duplicates. A1 = 1(from) A2 = 100(to) A3 = 5 (Required random number) A4,A5,A6,A7,A8 in cell should generate random number 回答1: As fafl pointed you can use a list. Generate list according to Range Pop n Numbers out of them randomly one by one Write popped Numbers to sheet Here is an example. /*Note: The Code does not have validations like the random number needed should be less than the range etc. You should

Generate 'n' unique random number within a range

最后都变了- 提交于 2021-02-08 08:19:14
问题 I need to generate 5 random number within a specific range from 1 to 100 with out duplicates. A1 = 1(from) A2 = 100(to) A3 = 5 (Required random number) A4,A5,A6,A7,A8 in cell should generate random number 回答1: As fafl pointed you can use a list. Generate list according to Range Pop n Numbers out of them randomly one by one Write popped Numbers to sheet Here is an example. /*Note: The Code does not have validations like the random number needed should be less than the range etc. You should

Issues using setValues function

安稳与你 提交于 2021-02-08 08:15:51
问题 I keep getting an error message when using the setValues() function to export an array to Google sheets. I have tried many different methods for creating my 2D array, but I still keep getting the same errors. Sometimes my code will run (the array will export to the spreadsheet) but I will still get an error. I originally used the setValue() function in a for loop but the code would time out because it ran too long. So I tried dumping all my data into a 2D Array and feeding that to the

Issues using setValues function

巧了我就是萌 提交于 2021-02-08 08:15:39
问题 I keep getting an error message when using the setValues() function to export an array to Google sheets. I have tried many different methods for creating my 2D array, but I still keep getting the same errors. Sometimes my code will run (the array will export to the spreadsheet) but I will still get an error. I originally used the setValue() function in a for loop but the code would time out because it ran too long. So I tried dumping all my data into a 2D Array and feeding that to the

How do I get domestic shipping rates via the USPS API using Google Apps Script?

和自甴很熟 提交于 2021-02-08 08:12:23
问题 Upon loading this link, which is composed of the user ID provided by USPS and details regarding the package, in my browser Link: http://production.shippingapis.com/ShippingAPITest.dll?API=RateV4&XML=<RateV4Request USERID="[userid]"><Revision/><Package ID="1ST"><Service>PRIORITY</Service><ZipOrigination>02211</ZipOrigination><ZipDestination>90210</ZipDestination><Pounds>5</Pounds><Ounces>2</Ounces><Container>RECTANGULAR</Container><Size>LARGE</Size><Width>15</Width><Length>30</Length><Height

Delete row if column has date older than one month

我与影子孤独终老i 提交于 2021-02-08 08:05:54
问题 I found this code from https://stackoverflow.com/users/6656050/jeremy-kahan and edited it a little. I need my sheet to delete any row when the entry in column L is older than one month, but keep the row if the cell in column L is empty i'll need some guidance. On request I can provide a copy of my sheet and show examples. It might seem easy it others but I feel at a disadvantage only being 16 and just learning java. function DeleteOldEntries() { var ss = SpreadsheetApp.getActiveSpreadsheet();

Google script oauth2 Error: redirect_uri_mismatch

ε祈祈猫儿з 提交于 2021-02-08 07:59:31
问题 I am not asking this question without searching and reading the docs. I spent 2 days so far. I am sure I am missing sth. I am trying to implement google auth on drive spreadsheet. I have tried everything but still getting the error message (redirect_uri_mismatch). Basically, I want a sidepanel with a login screen. User clicks the button, auth magic runs and redirects to another html printing "Success" when the user allows access. I created a project in google dev console. created credentials

Google script oauth2 Error: redirect_uri_mismatch

坚强是说给别人听的谎言 提交于 2021-02-08 07:58:28
问题 I am not asking this question without searching and reading the docs. I spent 2 days so far. I am sure I am missing sth. I am trying to implement google auth on drive spreadsheet. I have tried everything but still getting the error message (redirect_uri_mismatch). Basically, I want a sidepanel with a login screen. User clicks the button, auth magic runs and redirects to another html printing "Success" when the user allows access. I created a project in google dev console. created credentials

Google photos api adding photos not working, upload seems to work

余生长醉 提交于 2021-02-08 07:35:27
问题 Trying to use Google Apps Script and Google Photos API to add photos to Google Photos. Upload seems to work / returns a token, but then adding the photo to the library fails. The process consists of two steps: 1. Upload the photo data as described here, then 2. Add the photo to photo library as described here. Step 1. works for me, as I get an upload token, but step 2 with source code below, throws an error, but my call has the one media item it needs. { "error": { "code": 400, "message":