Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Error `Cell range not allowed.` when using named expression defined as a cell range directly in a cell

Aperta
#1,533 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
tooling

Direzione di ricerca

Riproduci il comportamento con HyperFormula.buildFromArray, addNamedExpression e setCellContents usando gli esempi di intervalli denominati e formule presenti nell’issue. Traccia la valutazione delle espressioni denominate da questi punti di ingresso; il lavoro è completato quando un’espressione di intervallo o array usata direttamente in una cella non restituisce più “Cell range not allowed.”, mentre gli utilizzi aggregati come SUM(myRange) continuano a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Impact: Medium Named Expressions
Discussed in https://github.com/handsontable/hyperformula/discussions/1532

Originally posted by jablko August 12, 2025
Is it possible to replace the formula ={Sheet1!$A:$A} with a named range i.e. =myRange? Is there a trick I don't yet know?

The following:

import { HyperFormula } from "hyperformula";
// Named expressions can be used in any formula by referencing their names. Use
// them anywhere you would normally use a cell reference, range, or constant
// value.
// https://hyperformula.handsontable.com/guide/named-expressions.html#using-named-expressions-in-formulas
const row = [
  "={1;2}", // Target column
  "=myCell", // Works: named cell
  "={Sheet1!$A:$A}", // Works: range
  "=myRange", // Fails: identical range
  "=TRANSPOSE(TRANSPOSE({Sheet1!$A:$A}))", // Works: array formula
  "=myFormula", // Fails: identical array formula
  "=TRANSPOSE(TRANSPOSE(myRange))", // Fails: identical array formula
  "=SUM(myRange)", // Works: aggregate range
  "=SUM(myFormula)", // Works: aggregate formula
];
const options = {
  licenseKey: "gpl-v3",
  useArrayArithmetic: true,
};
const namedExpressions = [
  { name: "myCell", expression: "=Sheet1!$A$1" },
  { name: "myRange", expression: "={Sheet1!$A:$A}" },
  { name: "myFormula", expression: "=TRANSPOSE(TRANSPOSE({Sheet1!$A:$A}))" },
];
const hf = HyperFormula.buildFromArray([row], options, namedExpressions);
const start = { sheet: 0, row: 0, col: 0 };
const end = { sheet: 0, row: 0, col: row.length - 1 };
const result = hf.getRangeValues({ start, end });
console.log(result);

Prints:

[
  [
    1,
    1,
    1,
    DetailedCellError {
      value: '#VALUE!',
      address: undefined,
      type: 'VALUE',
      message: 'Cell range not allowed.'
    },
    1,
    DetailedCellError {
      value: '#VALUE!',
      address: undefined,
      type: 'VALUE',
      message: 'Cell range not allowed.'
    },
    DetailedCellError {
      value: '#VALUE!',
      address: undefined,
      type: 'VALUE',
      message: 'Cell range not allowed.'
    },
    3,
    3
  ]
]

@sequba analysis:

It is possible to define a named expression that corresponds to a range:

hf.addNamedExpression('myRange', '=Sheet1!$A:$A');

And it seems to be working inside formulas:

hf.setCellContents(addr, '=SUM(myRange)');

But for some reason, it returns an error when you try to use it directly in a cell:

hf.setCellContents(addr, '=myRange'); // ERROR: 'Cell range not allowed.'

It looks like a bug in HyperFormula that we need to examine closely to determine why it works this way.

Lingua principale
TypeScript
Stelle
2.8k
Fork
172
Merge medio
1g 19h
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di handsontable/hyperformula

Tutte le issue di handsontable/hyperformula

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.