What the script editor accepts and what Google Sheets accepts can be different?Trouble getting Google Sheets to Push to CalendarUsing Google Script to get an array from a list of cells in google sheetAdd editors or remove editors Google sheets dynamicallyGoogle apps script error: “You do not have permission to call protect”google sheets script missingReturn a value from json in Google Sheets script editorLink Google Script Editor to Google SheetGoogle Sheets Script to return sheet name will not automatically update on creating a new sheetGoogle sheets custom function error “Result was not a number”Running script on shared Google Sheets file

Overwrite file only if data

Is a butterfly one or two animals?

What professions would a medieval village with a population of 100 need?

Can we save the word "unique"?

Repetitive validation of Console inputs

Why does my house heat up, even when it's cool outside?

Is there a known non-euclidean geometry where two concentric circles of different radii can intersect? (as in the novel "The Universe Between")

Natural Pattern

What is the evidence on the danger of feeding whole blueberries and grapes to infants and toddlers?

Does the benefit of the Flames of Phlegethos feat that allows rerolls of fire damage affect its final benefit?

How to analyze "dearly beloved"?

How to create a summation symbol with a vertical bar?

What does it mean to have a subnet mask /32?

System to validate run time complexity requirements

How to "know" if I have a passion?

Why aren't RCS openings an issue for spacecraft heat shields?

Can others monetize my project with GPLv3?

Why would the US President need briefings on UFOs?

The teacher logged me in as administrator for doing a short task, is the whole system now compromised?

Why did this happen to Thanos's ships at the end of "Avengers: Endgame"?

Efficiently pathfinding many flocking enemies around obstacles

Why we don't have vaccination against all diseases which are caused by microbes?

Ask for a paid taxi in order to arrive as early as possible for an interview within the city

Should my "average" PC be able to discern the potential of encountering a gelatinous cube from subtle clues?



What the script editor accepts and what Google Sheets accepts can be different?


Trouble getting Google Sheets to Push to CalendarUsing Google Script to get an array from a list of cells in google sheetAdd editors or remove editors Google sheets dynamicallyGoogle apps script error: “You do not have permission to call protect”google sheets script missingReturn a value from json in Google Sheets script editorLink Google Script Editor to Google SheetGoogle Sheets Script to return sheet name will not automatically update on creating a new sheetGoogle sheets custom function error “Result was not a number”Running script on shared Google Sheets file






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















So I've been trying to build an AADD(range, range) function. It's not complete so don't rag me about that. What's bothering me at the moment is that what the Script Editor says in meaningful code and what Google Sheets will run appears to be different.



First of all here's the tester:



function test_AADD() 
var sheet = SpreadsheetApp.getActiveSheet();
var range1 = sheet.getRange("B2:E2");
var range2 = sheet.getRange("B3:D3");
var result = AADD(range1, range2);



The ranges are deliberately not matching in length because I'm trying to work out how to send back standard error messages like "#ERROR!" (some help there would help too.)



Here's the public AADD function. I hope one day to find out how to make functions private (another thing I need help with.)



/**
* Adds two arrays
*
* @param Range range1 The first parameter
* @param Range range2 The second paramter
* @return Range
* @customfunction
*/
function AADD(range1, range2)
return fnAADDrr(range1, range2);



The (ultimately) private function that implements the AADD code (trust me, there's meaning to the madness) is



function fnAADDrr(range1, range2) 
var r1len = range1.getNumRows() * range1.getNumColumns();
var r2len = range2.getNumRows() * range2.getNumColumns();
if (r1len !== r2len)
return new Error("#ERROR!");




That's as far as the function goes at this point because I'm just trying to work out how to test for a Range not having as many items as another.



So now we get to the main problem: When I have the script, the script editor does not complain about the method calls on the passed-in Range variables range1 and range2. And when I run the test_AADD function in the script editor, I get a mostly sensible response (except that the "new Error" thing isn't actually returning -- something else I need help with.)



So then I move back to my Google Sheets file. In a cell I type



=AADD(B2:D2,B3:D3)


Now this isn't even going to fire the "new Error" bit because the Ranges are the same size. Even so, I get an "#ERROR!" which, if I hover over it with the mouse I get



TypeError: Cannot find function getNumRows in object 1,2,3 (line 73) 


where 1,2,3 is what's in B2:D2, and line 73 is the location in the script file.



So how come script editor and Google Sheets can't agree on what's allowed?










share|improve this question





















  • 2





    Calling a script function from Google Sheets (i.e. a "custom function") passes only value arrays as arguments. Not Range class objects. Also, errors are thrown, not returned

    – tehhowch
    Mar 27 at 16:03







  • 1





    @bugmagnet Check the Apps Script guides. There is a section dedicated to building custom sheet formulas using functions. Its a relatively easy read and it should help to resolve most of your issues.

    – Dimu Designs
    Mar 27 at 22:52


















1















So I've been trying to build an AADD(range, range) function. It's not complete so don't rag me about that. What's bothering me at the moment is that what the Script Editor says in meaningful code and what Google Sheets will run appears to be different.



First of all here's the tester:



function test_AADD() 
var sheet = SpreadsheetApp.getActiveSheet();
var range1 = sheet.getRange("B2:E2");
var range2 = sheet.getRange("B3:D3");
var result = AADD(range1, range2);



The ranges are deliberately not matching in length because I'm trying to work out how to send back standard error messages like "#ERROR!" (some help there would help too.)



Here's the public AADD function. I hope one day to find out how to make functions private (another thing I need help with.)



/**
* Adds two arrays
*
* @param Range range1 The first parameter
* @param Range range2 The second paramter
* @return Range
* @customfunction
*/
function AADD(range1, range2)
return fnAADDrr(range1, range2);



The (ultimately) private function that implements the AADD code (trust me, there's meaning to the madness) is



function fnAADDrr(range1, range2) 
var r1len = range1.getNumRows() * range1.getNumColumns();
var r2len = range2.getNumRows() * range2.getNumColumns();
if (r1len !== r2len)
return new Error("#ERROR!");




That's as far as the function goes at this point because I'm just trying to work out how to test for a Range not having as many items as another.



So now we get to the main problem: When I have the script, the script editor does not complain about the method calls on the passed-in Range variables range1 and range2. And when I run the test_AADD function in the script editor, I get a mostly sensible response (except that the "new Error" thing isn't actually returning -- something else I need help with.)



So then I move back to my Google Sheets file. In a cell I type



=AADD(B2:D2,B3:D3)


Now this isn't even going to fire the "new Error" bit because the Ranges are the same size. Even so, I get an "#ERROR!" which, if I hover over it with the mouse I get



TypeError: Cannot find function getNumRows in object 1,2,3 (line 73) 


where 1,2,3 is what's in B2:D2, and line 73 is the location in the script file.



So how come script editor and Google Sheets can't agree on what's allowed?










share|improve this question





















  • 2





    Calling a script function from Google Sheets (i.e. a "custom function") passes only value arrays as arguments. Not Range class objects. Also, errors are thrown, not returned

    – tehhowch
    Mar 27 at 16:03







  • 1





    @bugmagnet Check the Apps Script guides. There is a section dedicated to building custom sheet formulas using functions. Its a relatively easy read and it should help to resolve most of your issues.

    – Dimu Designs
    Mar 27 at 22:52














1












1








1








So I've been trying to build an AADD(range, range) function. It's not complete so don't rag me about that. What's bothering me at the moment is that what the Script Editor says in meaningful code and what Google Sheets will run appears to be different.



First of all here's the tester:



function test_AADD() 
var sheet = SpreadsheetApp.getActiveSheet();
var range1 = sheet.getRange("B2:E2");
var range2 = sheet.getRange("B3:D3");
var result = AADD(range1, range2);



The ranges are deliberately not matching in length because I'm trying to work out how to send back standard error messages like "#ERROR!" (some help there would help too.)



Here's the public AADD function. I hope one day to find out how to make functions private (another thing I need help with.)



/**
* Adds two arrays
*
* @param Range range1 The first parameter
* @param Range range2 The second paramter
* @return Range
* @customfunction
*/
function AADD(range1, range2)
return fnAADDrr(range1, range2);



The (ultimately) private function that implements the AADD code (trust me, there's meaning to the madness) is



function fnAADDrr(range1, range2) 
var r1len = range1.getNumRows() * range1.getNumColumns();
var r2len = range2.getNumRows() * range2.getNumColumns();
if (r1len !== r2len)
return new Error("#ERROR!");




That's as far as the function goes at this point because I'm just trying to work out how to test for a Range not having as many items as another.



So now we get to the main problem: When I have the script, the script editor does not complain about the method calls on the passed-in Range variables range1 and range2. And when I run the test_AADD function in the script editor, I get a mostly sensible response (except that the "new Error" thing isn't actually returning -- something else I need help with.)



So then I move back to my Google Sheets file. In a cell I type



=AADD(B2:D2,B3:D3)


Now this isn't even going to fire the "new Error" bit because the Ranges are the same size. Even so, I get an "#ERROR!" which, if I hover over it with the mouse I get



TypeError: Cannot find function getNumRows in object 1,2,3 (line 73) 


where 1,2,3 is what's in B2:D2, and line 73 is the location in the script file.



So how come script editor and Google Sheets can't agree on what's allowed?










share|improve this question
















So I've been trying to build an AADD(range, range) function. It's not complete so don't rag me about that. What's bothering me at the moment is that what the Script Editor says in meaningful code and what Google Sheets will run appears to be different.



First of all here's the tester:



function test_AADD() 
var sheet = SpreadsheetApp.getActiveSheet();
var range1 = sheet.getRange("B2:E2");
var range2 = sheet.getRange("B3:D3");
var result = AADD(range1, range2);



The ranges are deliberately not matching in length because I'm trying to work out how to send back standard error messages like "#ERROR!" (some help there would help too.)



Here's the public AADD function. I hope one day to find out how to make functions private (another thing I need help with.)



/**
* Adds two arrays
*
* @param Range range1 The first parameter
* @param Range range2 The second paramter
* @return Range
* @customfunction
*/
function AADD(range1, range2)
return fnAADDrr(range1, range2);



The (ultimately) private function that implements the AADD code (trust me, there's meaning to the madness) is



function fnAADDrr(range1, range2) 
var r1len = range1.getNumRows() * range1.getNumColumns();
var r2len = range2.getNumRows() * range2.getNumColumns();
if (r1len !== r2len)
return new Error("#ERROR!");




That's as far as the function goes at this point because I'm just trying to work out how to test for a Range not having as many items as another.



So now we get to the main problem: When I have the script, the script editor does not complain about the method calls on the passed-in Range variables range1 and range2. And when I run the test_AADD function in the script editor, I get a mostly sensible response (except that the "new Error" thing isn't actually returning -- something else I need help with.)



So then I move back to my Google Sheets file. In a cell I type



=AADD(B2:D2,B3:D3)


Now this isn't even going to fire the "new Error" bit because the Ranges are the same size. Even so, I get an "#ERROR!" which, if I hover over it with the mouse I get



TypeError: Cannot find function getNumRows in object 1,2,3 (line 73) 


where 1,2,3 is what's in B2:D2, and line 73 is the location in the script file.



So how come script editor and Google Sheets can't agree on what's allowed?







google-apps-script google-sheets custom-function






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 16:03









tehhowch

6,7584 gold badges12 silver badges31 bronze badges




6,7584 gold badges12 silver badges31 bronze badges










asked Mar 27 at 15:48









bugmagnetbugmagnet

4,3956 gold badges49 silver badges111 bronze badges




4,3956 gold badges49 silver badges111 bronze badges










  • 2





    Calling a script function from Google Sheets (i.e. a "custom function") passes only value arrays as arguments. Not Range class objects. Also, errors are thrown, not returned

    – tehhowch
    Mar 27 at 16:03







  • 1





    @bugmagnet Check the Apps Script guides. There is a section dedicated to building custom sheet formulas using functions. Its a relatively easy read and it should help to resolve most of your issues.

    – Dimu Designs
    Mar 27 at 22:52













  • 2





    Calling a script function from Google Sheets (i.e. a "custom function") passes only value arrays as arguments. Not Range class objects. Also, errors are thrown, not returned

    – tehhowch
    Mar 27 at 16:03







  • 1





    @bugmagnet Check the Apps Script guides. There is a section dedicated to building custom sheet formulas using functions. Its a relatively easy read and it should help to resolve most of your issues.

    – Dimu Designs
    Mar 27 at 22:52








2




2





Calling a script function from Google Sheets (i.e. a "custom function") passes only value arrays as arguments. Not Range class objects. Also, errors are thrown, not returned

– tehhowch
Mar 27 at 16:03






Calling a script function from Google Sheets (i.e. a "custom function") passes only value arrays as arguments. Not Range class objects. Also, errors are thrown, not returned

– tehhowch
Mar 27 at 16:03





1




1





@bugmagnet Check the Apps Script guides. There is a section dedicated to building custom sheet formulas using functions. Its a relatively easy read and it should help to resolve most of your issues.

– Dimu Designs
Mar 27 at 22:52






@bugmagnet Check the Apps Script guides. There is a section dedicated to building custom sheet formulas using functions. Its a relatively easy read and it should help to resolve most of your issues.

– Dimu Designs
Mar 27 at 22:52













0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55381362%2fwhat-the-script-editor-accepts-and-what-google-sheets-accepts-can-be-different%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55381362%2fwhat-the-script-editor-accepts-and-what-google-sheets-accepts-can-be-different%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해