Bug 158622 - CSV which contains #N/A, cannot read as #N/A(NaN, Not a Number)
Summary: CSV which contains #N/A, cannot read as #N/A(NaN, Not a Number)
Status: NEEDINFO
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.4.1 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-10 03:39 UTC by polyester
Modified: 2023-12-13 05:44 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description polyester 2023-12-10 03:39:32 UTC
Description:
CSV file which contains #N/A, cannot read as #N/A(NaN, Not a Number).

Steps to Reproduce:
1.Generate spreadsheet which contains #N/A in a cell. "=NA()" works fine.
2.Save the spreadsheet as CSV.
3.Check the CSV file by text editor(Vim, Emacs, ...).
  We can look #N/A in the file.
4.Read the CSV file using Calc.
5.Check the cell(containg #N/A) using ISNA() function.

Actual Results:
#N/A interpreted as string, so ISNA() return FALSE.

Expected Results:
#N/A in CSV should interpret as #N/A(NaN, Not A Number).


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1
CPU threads: 4; OS: Windows 10.0 Build 22631; UI render: Skia/Vulkan; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: threaded
Comment 1 ady 2023-12-10 06:29:01 UTC
When saving as CSV:

* Edit filter settings"
** Save cell formulas instead of calculated values

When opening the CSV file with Calc, set the "Evaluate formulas" check box ON.


Are you using those settings?

If not, please specify which steps/settings you are using when saving the CSV and which ones when opening it. It may be helpful to "Add an attachment" with a sample csv file to your next post/comment in the bug report page.

For me, no repro.

Setting to NEEDINFO.
Comment 2 Mike Kaganski 2023-12-10 09:08:42 UTC
Note that #N/A! (e.g., returned by NA()) is *not* "NaN" ("not a number"), but "not available" (see https://help.libreoffice.org/latest/en-US/text/scalc/05/02140000.html?DbPAR=CALC ).

Also note that indeed, a literal text "#N/A!" in a CSV is not any kind of error - CSV has *no* notion of data type, and it can't store errors at all. Unless you follow comment 1, and store formulas instead of values, this is NOTABUG. File format limitations must be taken into account; one can't similarly expect to store font formatting and images in TXT files.
Comment 3 polyester 2023-12-12 21:42:50 UTC
And... Microsoft Excel can reproduce #N/A from CSV in these forms(case insensitive):
=NA(),=na(),=Na(),=nA(),#N/A,#n/a,#N/a,#n/a

So, for compatibility, it's better to interpret #N/A in CSV as #N/A(not string).
Comment 4 polyester 2023-12-12 21:49:40 UTC
Sorry(typo) :
- =NA(),=na(),=Na(),=nA(),#N/A,#n/a,#N/a,#n/a
+ =NA(),=na(),=Na(),=nA(),#N/A,#n/a,#N/a,#n/A
Comment 5 ady 2023-12-12 21:57:41 UTC
@polyester,

You don't seem to answer the prior comments / questions. Am I missing something?
Comment 6 Mike Kaganski 2023-12-13 05:44:25 UTC
(In reply to polyester from comment #3)

MS Excel is not an authority in CSV (if it was XLSX, this argument would be sound).