Skip to main content
4 votes
Accepted

Function to format numbers with thousand separators and decimals

You can use default parameters to automatically assign a value if none is given. function neat(numToFormat, thousandSep = ".", decimalSep = ",") You should start ...
Kruga's user avatar
  • 1,124
4 votes

Setting values in a spreadsheet

You can put all the value content to be set into an array, and set all the values at once. ...
Alan Wells's user avatar
3 votes
Accepted

List with values not found in another list when each index has two objects

Your solution can be simplified to a few lines. This peice of code is written twice in your function and simply creates a list of "keys" to identify each sub array of your list. ...
kockburn's user avatar
  • 1,356
3 votes
Accepted

Hide rows where column F is not empty

In order to improve the performance of your script you should read cell values from an array that represents the entire range that your are going to scan. This means that instead of repetedly calling ...
t3chb0t's user avatar
  • 44.3k
3 votes
Accepted

Extract a number from a consecutive range in a Google Sheet

I guess the answer could be useful to someone that begin like me in coding...Anyway the tip here was to create an array first (I named it table) instead of adding ...
Shinobe's user avatar
  • 51
2 votes

Lock-range code for Google Scripts/Sheets

It's not necessary to include SpreadsheetApp.flush() as the last command of the if blocks because there aren't any command to be executed after those blocks and ...
Rubén's user avatar
  • 163
2 votes

Returns Google Sheet cells from a named range

I didn't run unit tests for this on different search inputs, but it should give an idea of how you can bundle index information into the results for consumption with array class methods. Because you ...
tehhowch's user avatar
  • 151
2 votes
Accepted

Minimize this IF statement

Since the activeCell.getRow() is repeated in all ifs, the only way I see of refactoring your code without overcomplicating the script is the following: ...
Davichete's user avatar
  • 176
2 votes

Nesting for loops to find matches in different tables

I don't know enough about the shape of testData to write great code, but you could preprocess and convert testData from an array ...
Drew Reese's user avatar
2 votes

Set Dates on Spreadsheet Rows

General review Generally the code is OK and problems are due to lack of experience rather than bad style or habit. I am unfamiliar with SpreadsheetApp so you should wait in case someone that is adds ...
Blindman67's user avatar
  • 22.3k
2 votes
Accepted

Grouping arrays with different lengths to make a single sentValues() for the spreadsheet

Use const and let as needed instead of declaring all variables as var. This helps the ...
TheMaster's user avatar
  • 256
2 votes
Accepted

Replace/remove all diacritics and converting different letters to Latin alphabet in multiple spreadsheet columns (multidimensional array)

Use a simple recursive function using Array.map. This maintains the initial structure of the multidimensional array without needing loops and all those array/string manipulations of ...
TheMaster's user avatar
  • 256
2 votes
Accepted

Copy and Pasting Values from Spreadsheets

Review This review pertains to the updated version of the code. Overall the code is bloated and noisy. Even after a clean up it feels wrong (ambiguous) as the ...
Blindman67's user avatar
  • 22.3k
2 votes
Accepted

Sending Email Through App Script

Disclaimer This is all untested code, written just based on reading the documentation. If there's any inaccuracies, please just comment below and I will fix them. Instead of having a ton of functions,...
Ismael Miguel's user avatar
2 votes
Accepted

Pulling Data from an Email and Pasting it into a Google Spreadsheet

This is what I came up with so far that I felt helped concatenate all my code. I used a similar methodology from this question that I also asked: Sending Email Through App Script. Anyone is welcome to ...
Lofton Gentry's user avatar
2 votes
Accepted

Slow performance of Google Apps Script that updates data

As the documentation says, Using JavaScript operations within your script is considerably faster than calling other services. Anything you can accomplish within Google Apps Script itself will be much ...
TheMaster's user avatar
  • 256
1 vote

Calculate cumulative daily rainfall

Welcome to Code Review. Here are a few improvements to the code: Use const and arrow notation for your functions. Stick to the DRY (Don't Repeat Yourself) ...
Miguel Alorda's user avatar
1 vote

Slow performance of Google Apps Script that updates data

As this answer explains calling SpreadsheetApp.getActiveSpreadsheet() in every single iteration can slow things down dramatically. Moving that outside the loops can ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
1 vote
Accepted

Google App Script Automation for User Onboarding

You could leverage a more object orient approach to create an instance of a user ...
Jason Leaver's user avatar
1 vote

List with values not found in another list when each index has two objects

The reason why I asked about concatenation is that its unnecessary unless you wanted to catch matching concatenations regardless of the inputs. It seems that's not the case, so why not just compare ...
Dave Meehan's user avatar
1 vote
Accepted

JavaScript: proper user of SJCL encryption in Google Apps Script

User enter passphrase Nobody uses an OS modal dialog prompts anymore. I'd suggest a web page specific modal box such as shown here. You need to click "new user" to have the box show up. As ...
Maarten Bodewes's user avatar
1 vote

Google apps script Exceeded maximum execution time issue or 29k rows

According to a benchmark report by Tanaike Methods of Sheets API can reduce the process costs from those of Spreadsheet Service by about 19 %. But in the case of this script the impact of replacing ...
Rubén's user avatar
  • 163
1 vote

Function to format numbers with thousand separators and decimals

Style and code For max integer value use Number.MAX_SAFE_INTEGER Use === rather than == ...
Blindman67's user avatar
  • 22.3k
1 vote

Google Apps Script to create an invoice

It is difficult to know exactly what the root cause of the slowness but I see some possible inefficiencies in the code. The first thing I see is that the body and ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
1 vote
Accepted

Google Apps Script shifting columns containing specified substring - using array functions

Just as a general note, you could avoid the temporary array by copying the array from the end. I would also use a temporary variable for simplicity: ...
Marc Rohloff's user avatar
  • 3,477
1 vote

Modal displayed in Google Spreadsheet from Gscript

Redundant Code at the end of regenProductCache() The following code appears at the end of that function: ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
1 vote

Copying contents of cells in a vehicle-tracking Google Sheet

Put all of your range notations into an object literal with inner arrays. See the object literal named objectRangeSettings Only check for ...
Alan Wells's user avatar
1 vote
Accepted

Bottlenecks in asynchronous JavaScript code for Google Map

Storing coordinates in Google Apps Script, instead of fetching each time on client-side As was alluded to in your comment, yes the fetching of GPS coordinates could be handled on the server side. ...
Sᴀᴍ Onᴇᴌᴀ's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible