Bug 150836 - CSV save-mode is different from the one used for opening
Summary: CSV save-mode is different from the one used for opening
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: CSV-Export
  Show dependency treegraph
 
Reported: 2022-09-06 22:12 UTC by Konstantin Kharlamov
Modified: 2023-01-31 12:59 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 Konstantin Kharlamov 2022-09-06 22:12:54 UTC
I use CSV+formulas as a plain-text format that can be stored in git and wouldn't require typing formulas anew. Unfortunately, when using Ctrl+s to save an edited CSV file, all formulas are lost. They shouldn't be, because LO knows the exact format it used for loading the file.

Repro with latest 7.4.0.3

# Steps to reproduce

1. Execute `echo "2,=A1*A1" > test.csv`
2. Open the created `test.csv` in LO Calc `localc ./test.csv`
3. A window with file load configuration will pop up: make sure a `✓ Evaluate formulas` checkbox is checked and press `Ok`
4. Press Ctrl+s to save the file. LO will only ask if you're sure about the format, press `Use Text CSV Format`
5. In terminal execute `cat test.csv`

## Expected output

    2,=A1*A1

## Actual output

    2,4

# Workarounds

Use `Save as` (Shift + Ctrl +s), then in popped up window make sure a "✓ Edit filter settings" is set. When through a few windows the filter settings appear, make sure a "✓ Save cell formulas instead of calculated values" is set.

Fun thing: the checkbox is set by default. But apparently Ctrl+s disagrees.
Comment 1 Rafael Lima 2022-09-07 15:22:05 UTC
This seems weird indeed. When you check "Evaluate formulas", the opened CSV file shows the value 4 in cell B1, but if you select the cell and check its contents you'll notice that it does have a formula, not the value "4".

So saving the file as CSV should save the formula as well.
Comment 2 Michael Warner 2022-09-08 14:26:06 UTC
(In reply to Konstantin Kharlamov from comment #0)
> I use CSV+formulas as a plain-text format that can be stored in git and
> wouldn't require typing formulas anew.

Have you considered using Flat XML ODF Spreadsheet (.fods) for this purpose?
Comment 3 Konstantin Kharlamov 2022-09-08 15:24:19 UTC
(In reply to Michael Warner from comment #2)
> (In reply to Konstantin Kharlamov from comment #0)
> > I use CSV+formulas as a plain-text format that can be stored in git and
> > wouldn't require typing formulas anew.
> 
> Have you considered using Flat XML ODF Spreadsheet (.fods) for this purpose?

Oh, thanks! I didn't know about that format. Yeah, that's an interesting solution. Although it has lots of text compared to CSV, but on the upside, adding new columns will grow the file down, so it's easier to compare the diffs (CSV files would grow to the right).

Thank you!
Comment 4 Buovjaga 2023-01-31 12:59:54 UTC
NEW per comment 1