Bug 159071 - Inconsistent approach to formulae in csv
Summary: Inconsistent approach to formulae in csv
Status: NEEDINFO
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.4.1 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-08 10:35 UTC by isaac.o.braham
Modified: 2024-01-11 11:10 UTC (History)
1 user (show)

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 isaac.o.braham 2024-01-08 10:35:44 UTC
Saving formulae as written in csv files is already fraught with inconsistencies, but this latest is most problematic.

1. Open a csv file with formulae (using the 'Evaluate Formulas' option) - the formulae can be shown resolved in the open file (depending on your settings) - the result is shown.

2. Click on 'Save As...' and select to overwrite, edit filter settings, 'Save cell formulae instead of values'

3. Continue working with the sheet, the formulae continue to work (results are shown), but make no new edits.

4. Close the sheet - **no new dialogue opens because apparently no changes have been made since the last save**

5. Examine the csv - **the formulae have been saved as their results, not as formulae**

This is inconsistent because the last save specifically requested that the formulae be saved as formulae and no other edits have taken place since and no new save dialogue opens up (confounding the impression that the file is saved exactly as last requested).

Why is it not simply that the 'Save' button (which already saves a csv if it was opened as csv) use whatever defaults the 'Save As...' option is set to? 

Why default to filter settings the user has specifically asked not to be used for this file?
Comment 1 Julien Nabet 2024-01-08 10:56:57 UTC
I don't understand what you mean when you're talking about formula in a csv file.
I mean, csv files contain data not formula. Formula are in ods, xlsx, xls... files.

Could you attach an example csv file containing formula?
Comment 2 isaac.o.braham 2024-01-11 09:31:12 UTC
Happy to add an attachment if necessary but it's not complicated to explain so I'll try that first.

The string "=Sum(E1:E4)" is a formula. It won't do anything in a csv, of course, but it doesn't stop being a formula - a string with an '=' in it is a formula (usually).

Just like the string "Nc3 Nf6" is a chess move, whether or not is in some software that can read chess moves.

If one is saving an ODS to a CSV (most likely for transfer to some other software), then it's possible one might want to save the 'formula' not the result of the formula. Presumably this is why all these confounded options abound in the first place.

I'm just pointing out that the means by which one might go about doing this are very counter-intuitive in that one would use the process - Click on 'Save As...' and select to overwrite, edit filter settings, 'Save cell formulae instead of values' - but after that's done and the the file is closed, LibreOffice ignores this instruction and saves the values anyway.
Comment 3 ady 2024-01-11 10:23:36 UTC
I just tried with LO 7.6.3.2 and with a recent alpha; no repro.

When saving as csv, the only filter setting that I checked ON was to save the formulas (as opposed to saving the values); I set OFF the other options.

When opening the resulting CSV in a text editor, I clearly see that the formula was saved, not the resulting value.

When I reopen the csv with Calc, I used the "evaluate formulas" import option. All works as expected.

Generally speaking, in order to report a problem when exporting/saving as some format (such as CSV), the report must include which options where set ON/OFF; otherwise it cannot be reproduced.

If you start with an ODF file (which is not what you described in comment 0) and want to export it as CSV and that's somehow failing, please attach such ODF. Please be aware that it would be publicly available.

Anyway, not repro.
Comment 4 Julien Nabet 2024-01-11 10:29:02 UTC
Thank you for the feedback, I understand better now.
I let you read the Ady's comment but since I don't have more questions, I'll put it back to UNCONFIRMED.
Comment 5 ady 2024-01-11 11:10:55 UTC
(In reply to isaac.o.braham from comment #0)

> 2. Click on 'Save As...' and select to overwrite, edit filter settings,
> 'Save cell formulae instead of values'

If you only choose the adequate filter settings, this should work as expected.

Now, the problem _might_ be when using "Save" with no selection of filters.

For instance, let's say you selected first "Save as..." with adequate filters, and after some additional time or further work you selected "Save". Is it possible that the "second" Save (not "Save as") screwed up your prior filter selection?

Please leave aside the options you chose when opening the CSV. I am asking about the exporting options when selecting Save as.

Please clarify the question about Saving (a possible "second save", after the first "Save as", with adequate filters). IOW, please clarify the steps to reproduce, in the most basic clearly described form.

Setting NEEDINFO.