Contact

Google Sheets web app (rolling service) · Reusable formulas · Intermediate

Import Google Sheets named functions without accidental overwrites

Move reusable formulas between Google Sheets files, inspect dependencies and name collisions, and verify results before replacing a working definition.

Documentation-reviewed draft; not tested in Google Sheets. · Editorial standards

Check the destination’s existing names before importing. A same-name imported function replaces the existing definition. Importing a useful formula is therefore a change to the destination’s calculation logic, not merely adding a shortcut. Google’s named-function import rules

Prepare a controlled migration

Use two disposable Google Sheets files in a desktop browser, Function library and Function test. You need permission to edit them. These instructions use English function names and comma separators. Named functions are available to Workspace and personal Google accounts. No Apps Script, API or add-on is involved. Google’s availability announcement

Before working in a live file, record the current definitions, argument order and known outputs. Keep a recoverable copy. Decide whether you intend to replace an existing function or keep both versions. An import should not make that decision for you.

1. Define a small library with a dependency

In Function library, open Data → Named functions → Add new function and create these two definitions, in order. Enter the placeholders separately in the order listed, then choose Next → Create. Creation workflow Names must avoid built-ins and cell-address syntax; underscores are allowed. Creation requirements

First function

  • Name: ST_LINE_V1
  • Description: Quantity times unit price, rounded to two decimal places.
  • Argument placeholders: qty, unit_price
  • Formula definition: =ROUND(qty*unit_price,2)

Second function

  • Name: ST_ORDER_V1
  • Description: Rounded line value plus one shipping charge.
  • Argument placeholders: qty, unit_price, shipping
  • Formula definition: =ST_LINE_V1(qty,unit_price)+shipping

These synthetic formulas are for one line item, not a complete tax or invoicing model. All inputs are numeric, and shipping is one flat amount in the same currency unit as the line price. The use of ROUND is deliberate: rounding happens before shipping is added.

Notice that the second function needs the first. Importing a name without checking its dependencies leaves part of the calculation contract unexamined.

2. Establish expected results

In unused cells in Function library, enter these calls:

Test Formula Expected result
Ordinary order =ST_ORDER_V1(2,4.50,1) 10.00
Zero quantity =ST_ORDER_V1(0,4.50,1) 1.00
Rounding case =ST_ORDER_V1(3,1.255,2) 5.77

The zero-quantity result is intentionally 1, because this simple definition still adds shipping. If your intended policy waives shipping at zero quantity, the definition is wrong for your business even though it computes exactly as designed. Resolve that decision before distributing it.

3. Reproduce a name collision safely

In Function test, create an older practice function with the same name ST_ORDER_V1, the same three placeholders, but this definition:

=ROUND(qty*unit_price,2)+shipping+5

The extra 5 represents an old surcharge. For (2,4.50,1), the destination currently returns 15.00. Record that result and definition before continuing. This is your deliberate collision fixture; do not create it in production.

Now decide:

  • Keep old and new behavior: Give the new library functions distinct versioned names, such as ST_LINE_V2 and ST_ORDER_V2, updating the dependency inside the new order definition too. Then import those names.
  • Replace the old behavior: Proceed only after the destination owner agrees that formulas calling ST_ORDER_V1 should use the new policy.

A new outer name alone is insufficient if it depends on an old helper name that you accidentally replace.

4. Import and inspect the warnings

In the destination, choose Data → Named functions → Import function, select the source file, and select the required definitions. Inspect same-name conflicts, dependent functions and any external-source warnings before committing the import. Google documents dependency highlighting and external interactions, including IMAGE. Import workflow and warnings

For this exercise, the required set is ST_LINE_V1 plus ST_ORDER_V1. Neither definition refers to a website or another spreadsheet’s cells. If a different library unexpectedly contains such a reference, stop and inspect what it reads or contacts. Do not treat an external-source warning as a routine checkbox.

5. Verify the destination and record the version

After the deliberate replacement, rerun all three tests in Function test. Expected results are 10.00, 1.00, 5.77. The old test cell should change from 15 to 10. If keeping both versions, verify the old-name call remains 15 and the newly named call returns 10.

Record the import date, source file, names, definitions and test results in your own change record. Do not assume later changes in Function library automatically update the imported definitions; plan any later replacement as a fresh reviewed migration.

Troubleshooting

Wrong result without an error: Compare argument order and every helper definition, not just the function name. Shipping and unit price are both numbers, so swapping them can produce a plausible wrong answer.

Unexpected reference to the source tab: Literal ranges in named-function definitions become absolute; pass changing ranges as arguments instead. A name behaves ambiguously: Check named ranges too, because a same-name named range takes precedence. Named-function FAQ

An existing workflow changes: Restore the saved previous definition in the controlled recovery copy, verify the old tests, and agree on a new naming plan before touching the live version again.

LAMBDA is useful background for reusable calculations; importing named definitions is a separate migration workflow.

Testing disclosure: Official documentation reviewed October 16, 2026 and expected arithmetic independently calculated. This tutorial has not been tested in Google Sheets; import dialogs, warning presentation and recalculation after replacement remain application checks.