Skip to content
Astera Technology

Why did plain text become a formula cell during migration?

Emit a text-typed worksheet cell fragment for declared text, including a leading equals sign.

Download complete case notes and answer keys ↓

Read the source and its declared rule

This original output exercise emits only an Open XML worksheet-cell fragment. Source kind text with value=1+1 must stay text; treating its equals sign as permission to emit an f formula changes meaning. Numeric source cells follow their separate numeric representation.

Filled synthetic input
RecordInput JSON
Base input{"kind":"text","value":"=1+1"}
Download editable CSV ↓

Compare the actual paths

Correct output uses inlineStr and escaped text content. It is a fragment type demonstration, not an XLSX package or an executed spreadsheet; no universal CSV quoting convention is asserted.

Misleading and corrected outputs
PathOutput JSON
Misleading path{"fragment":"<c><f>1+1</f></c>"}
Corrected path{"fragment":"<c t=\"inlineStr\"><is><t>=1+1</t></is></c>"}
Download editable CSV ↓
Local Node.js program: 22.23.3 or 24.14.1
import {DatabaseSync} from 'node:sqlite';
import {TextDecoder} from 'node:util';
import {inflateSync} from 'node:zlib';
import {posix} from 'node:path';
import {createHash} from 'node:crypto';
const rows=(db,sql)=>db.prepare(sql).all().map(r=>({...r}));
const failed=(action)=>{try{action();return null;}catch(e){return {code:e.errcode??e.code??e.name};}};

import assert from 'node:assert/strict';
const run=function run(i,corrected=true){
    const escape=s=>s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
    if(i.kind==='number')return {fragment:'<c><v>'+i.value+'</v></c>'};
    if(!corrected&&i.value.startsWith('='))return {fragment:'<c><f>'+escape(i.value.slice(1))+'</f></c>'};
    return {fragment:'<c t="inlineStr"><is><t>'+escape(i.value)+'</t></is></c>'};
  };
const cases=[{"label":"misleading base","input":{"kind":"text","value":"=1+1"},"expected":{"fragment":"<c><f>1+1</f></c>"},"corrected":false},{"label":"corrected base","input":{"kind":"text","value":"=1+1"},"expected":{"fragment":"<c t=\"inlineStr\"><is><t>=1+1</t></is></c>"},"corrected":true},{"label":"ordinary text retains declared type","input":{"kind":"text","value":"Ada"},"expected":{"fragment":"<c t=\"inlineStr\"><is><t>Ada</t></is></c>"},"corrected":true},{"label":"genuine negative numeric cell","input":{"kind":"number","value":-2},"expected":{"fragment":"<c><v>-2</v></c>"},"corrected":true},{"label":"literal XML text is escaped","input":{"kind":"text","value":"A<&>"},"expected":{"fragment":"<c t=\"inlineStr\"><is><t>A&lt;&amp;&gt;</t></is></c>"},"corrected":true}];
for(const test of cases){
  const actual=run(test.input,test.corrected);
  assert.deepEqual(actual,test.expected,test.label);
  console.log(test.label,actual);
}
Download runnable example ↓

Check boundaries before the next load

Ordinary Ada remains text, genuine−2 remains numeric, and A<&> is emitted with literal XML text escaped.

Editable boundary records and expected outputs
CaseInput JSONExpected output JSON
Ordinary text cell{"kind":"text","value":"Ada"}{"fragment":"<c t=\"inlineStr\"><is><t>Ada</t></is></c>"}
Actual negative number{"kind":"number","value":-2}{"fragment":"<c><v>-2</v></c>"}
XML-special text{"kind":"text","value":"A<&>"}{"fragment":"<c t=\"inlineStr\"><is><t>A&lt;&amp;&gt;</t></is></c>"}
Download editable CSV ↓

Should the leading equals sign create a formula here?

Show the worked answer

No. Source kind is text. Preserve=1+1 inside an inline string cell rather than changing it to formula 1+1.

Related resources