Zoho Sheet · Automation and productivity · Intermediate
Build one custom function and document permissions and limits
Create a small Deluge custom function with an explicit numeric contract, test its boundaries, and document that shared functions run under the spreadsheet owner’s context.
Quick answer
Create a small Deluge custom function with an explicit numeric contract, test its boundaries, and document that shared functions run under the spreadsheet owner’s context.
Before you start
Zoho Sheet web editor in an English desktop browser; rolling service, official documentation reviewed 20 October 2026. Not desktop-app or mobile instructions. Use an editable practice file containing only synthetic data. Keep the original unchanged and record the file name and storage location so that you reopen the same copy. These are documentation-based instructions and independently checked examples, not a claim of native application testing.
Define a function small enough to audit
Create DOUBLE_UNITS, a numeric function that returns twice a supplied whole-number quantity. Its purpose is to demonstrate a custom-function workflow without a network request, integration or secret. The business rule is deliberately simple: for an input of 7, return 14; for 0, return 0; for -3, return -6 mathematically, although negative quantities may be invalid in a real process.
For ordinary doubling, a worksheet formula is simpler. Use the custom version only as a learning exercise or when a genuinely reusable business rule justifies maintaining code. Do not introduce external-service permissions to perform arithmetic.
Create and inspect the function
- Choose Tools → Custom Function → Create, the route documented for creating a basic function.
- Name it
DOUBLE_UNITS. The documented naming rules allow letters, digits and underscores, but not spaces, and the name cannot begin with a digit. - Choose an integer numeric return type and add one integer numeric argument named
unitsusing the available type controls. - In the generated Deluge function body, enter
return units * 2;. Retain the editor-generated declaration and braces for the selected types rather than replacing them with a signature copied from another Zoho product. - Save, then use the editor’s Run test with input 7. Expect 14. Test 0 and -3 as well and compare with the stated contract.
Deluge’s official arithmetic reference documents multiplication on numeric values. The function contains no application integration call, URL request or authentication token. If the editor rejects the selected type or body, resolve that error before inserting it into cells; an untested function name is not a working calculation.
Use it in a worksheet
Enter Units, Double and Independent check in A1:C1. Put 7, 0 and -3 in A2:A4. Find DOUBLE_UNITS through the Functions panel, insert it in B2 with A2 as its argument, and fill equivalent formulas into B3:B4. Enter =A2*2, =A3*2 and =A4*2 in C2:C4.
Expect B2:B4 and C2:C4 to match as 14, 0 and -6. Change A2 to 9 and verify both results become 18. This comparison catches argument or cell-reference mistakes without relying on the custom function itself as the checking mechanism.
The example’s contract accepts integer inputs. Do not silently truncate fractional quantities or treat a blank as zero; define and test those cases before expanding the rule. For production use, document whether negative quantities represent returns or invalid entry.
Explain permissions and limits
Zoho documents that custom functions run using the spreadsheet owner’s authentication context. Collaborators can use functions the owner has already used in that file but cannot inspect or edit the scripts. This makes a clear description and owner-side review important, even when the function currently performs only arithmetic.
Adding an integration later changes the risk: the owner’s account, access scope and current webhook/integration limits become relevant. Do not interpret this local calculation as approval to fetch CRM records or send data elsewhere.
The documentation also warns that deleting a custom function is not recoverable through that function workflow, and that a viewer’s saved copy of a published sheet loses the custom function and can show #NAME. Keep the source code and rule description separately, and check portability before sharing an exported or copied workbook. Prefer the ordinary worksheet formula when recipients need a self-contained, easily audited result.
Related tutorial
Continue with tables and named ranges.
Official sources
Documentation reviewed 20 October 2026.