Skip to content
Astera Technology

Why did a spreadsheet error become an empty imported value?

Keep typed cell errors separate from genuine blanks and literal text.

Download complete case notes and answer keys ↓

Read the source and its declared rule

The supplied extracted-cell record includes kind and value. An error cell containing #N/A must be held with that error retained. A text cell whose literal wording is #N/A is not the same input kind; a blank cell is represented separately as null.

Filled synthetic input
RecordInput JSON
Base input{"kind":"error","value":"#N/A"}
Download editable CSV ↓

Compare the actual paths

Bad output accepts an empty string, hiding the source fault. Good output holds source-cell-error with original #N/A instead of converting it into missing data.

Misleading and corrected outputs
PathOutput JSON
Misleading path{"accepted":true,"value":""}
Corrected path{"accepted":false,"error":"source-cell-error","original":"#N/A"}
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){
    if(i.kind==='error')return corrected?{accepted:false,error:'source-cell-error',original:i.value}:{accepted:true,value:''};
    return {accepted:true,value:i.kind==='blank'?null:i.value};
  };
const cases=[{"label":"misleading base","input":{"kind":"error","value":"#N/A"},"expected":{"accepted":true,"value":""},"corrected":false},{"label":"corrected base","input":{"kind":"error","value":"#N/A"},"expected":{"accepted":false,"error":"source-cell-error","original":"#N/A"},"corrected":true},{"label":"literal text resembles error","input":{"kind":"text","value":"#N/A"},"expected":{"accepted":true,"value":"#N/A"},"corrected":true},{"label":"genuine blank cell","input":{"kind":"blank","value":null},"expected":{"accepted":true,"value":null},"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

Literal text #N/A is accepted as text. A genuine blank is accepted as null under this optional-cell contract.

Editable boundary records and expected outputs
CaseInput JSONExpected output JSON
Literal error-looking text{"kind":"text","value":"#N/A"}{"accepted":true,"value":"#N/A"}
Genuine blank cell{"kind":"blank","value":null}{"accepted":true,"value":null}
Download editable CSV ↓

Are error #N/A and text #N/A interchangeable?

Show the worked answer

No. Their source kinds differ. Hold the error record and preserve the ordinary text record.

Related resources