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 ...
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.
...
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.
...
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
...
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 ...
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 ...
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 ...
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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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,...
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 ...
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 ...
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) ...
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 ...
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
...
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 ...
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 ...
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 ...
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 == ...
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 ...
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:
...
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:
...
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 ...
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.
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
google-apps-script × 69javascript × 41
google-sheets × 35
performance × 18
beginner × 10
google-maps × 5
array × 4
jquery × 3
datetime × 3
google-drive × 3
html × 2
formatting × 2
email × 2
google-app-engine × 2
php × 1
object-oriented × 1
parsing × 1
unit-testing × 1
time-limit-exceeded × 1
regex × 1
error-handling × 1
web-scraping × 1
cryptography × 1
html5 × 1
inheritance × 1