Bug 151133 - Introduce function to remove empty rows/columns
Summary: Introduce function to remove empty rows/columns
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.5.0.0 alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL: https://extensions.libreoffice.org/en...
Whiteboard:
Keywords:
Depends on:
Blocks: UNO-Command-New Cell-Management
  Show dependency treegraph
 
Reported: 2022-09-22 14:21 UTC by Sabri Unal
Modified: 2023-05-25 08:44 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
data with some empty rows (53.37 KB, image/png)
2022-09-22 14:22 UTC, Sabri Unal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sabri Unal 2022-09-22 14:21:58 UTC
Description:
If there are several lines and content it's not easy to remove them together. We have an idea.

Steps to Reproduce:
Hi, for example, I have a calc document with some data. I removed something from it. Now I have several empty rows in my data. (pic1.png)

I want to remove empty rows faster.

Actual Results:
In order to remove empty rows I may select and delete them individually.

Expected Results:
I wish to select the page or area than click on "Remove empty rows" command from menu.


Reproducible: Always


User Profile Reset: No



Additional Info:
You may also remove empty rows with filtering.

- Open a document 
- Create a scenario as pic1.png
- Click on the most left corner of Calc table to select all page
- Menu -> Data -> Auto Filter
- Click on the drop-down arrow of the table header
- Select only "Empty" lines
- On the document, select empty lines and than remove them.
- Return Auto Filter and reset back.

As you can see, this alternative is better for some cases but we may handle the situation faster.

This idea comes from:
- https://www.linuxteknik.com/libreoffice-calc-sheette-bos-satirlar-nasil-silinir/
- https://www.libreofficehelp.com/how-to-delete-blank-rows-in-libreoffice-calc-sheet/

---------------

Version: 7.4.1.2 / LibreOffice Community
Build ID: 3c58a8f3a960df8bc8fd77b461821e42c061c5f0
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-US (C); UI: en-US
Flatpak
Calc: threaded
Comment 1 Sabri Unal 2022-09-22 14:22:36 UTC
Created attachment 182627 [details]
data with some empty rows
Comment 2 Mike Kaganski 2022-09-22 14:49:45 UTC
Note also that one can select the empty rows as a multi-selection (e.g., using Find & Replace if applicable, or other methods), and then Sheet->Delete Rows.

Another possible way would be using sort.

Generally, I suppose that this is something specific, with unclear general usefulness. There may be infinite number of workflows, and each could have tens of "it would be nice if that was a single click" scenarios. IMO, a task for an extension.

A similar task (although IMO much more asked for, and thus more suitable to implement as a core feature) is solved by https://extensions.libreoffice.org/en/extensions/show/remove-duplicates-fast.
Comment 3 Rafael Lima 2022-09-23 01:02:45 UTC
There's an extension that removes blank rows and columns.

https://github.com/rafaelhlima/remove_blank_cells

See if this extension of the one recommended by Mike in Comment #2 does what you need and let us know.
Comment 4 Sabri Unal 2022-09-23 11:02:44 UTC
The last extention is my needs. Thanks. We can close the issue.
Comment 5 Timur 2022-09-23 12:11:57 UTC
For reporter, problem is solved with the extension. But for Bugzilla, status is not Fixed. 
It can be WontFix if it will never be accepted as an idea to integrate extension functionality into LO. Or New lowest enhancement to keep that possibility. 
I put WontFix so far but if there's an argument why it would be better in LO, anyone feel free to comment, we still may set New if there's a need.
Comment 6 Rafael Lima 2022-09-23 12:34:43 UTC
(In reply to Timur from comment #5)
> I put WontFix so far but if there's an argument why it would be better in
> LO, anyone feel free to comment, we still may set New if there's a need.

The use case reported by the OP is somewhat common. Often times we have a table in Calc and then we need to delete some rows, but only their contents (not the actual row). After deleting many rows, the user needs to compact the table by removing the empty rows.

Another use case is when you copy and paste tables from HTML pages into Calc, which sometimes results in some rows being empty and the user needs to compact the data.

The use cases described above led me to develop the Remove Blanks extension.

I would be willing to try to integrate this extension into LO. Maybe we could hear from the UX team if this is worth the effort.

Let's keep this as UNCONFIRMED and add the UX team in the loop. There's also a meta bug 145878 about implementing features as extensions.
Comment 7 Tomaz Vajngerl 2022-09-24 10:16:13 UTC
I think an explicit command for this would be useful.
Comment 8 Heiko Tietze 2022-09-26 08:56:28 UTC
I don't see this as a frequent use case. If you want to get rid of data you can remove a col/row with content. And isn't the compact function (removing all empty col or row) dangerous since you may have references that most often but not always needs adjustment.

Nothing to say against an extension, however. And improving it as well as having it on our extension site is a big plus. Other opinions?
Comment 9 Rafael Lima 2022-09-26 12:28:51 UTC
(In reply to Heiko Tietze from comment #8)
> Nothing to say against an extension, however. And improving it as well as
> having it on our extension site is a big plus. Other opinions?

The extension is also available in:

https://extensions.libreoffice.org/en/extensions/show/5747

I just need to update it to the latest version in LO extension website.

(In reply to Heiko Tietze from comment #8)
> I don't see this as a frequent use case.

It is hard to assess how frequent this use case is. All I can say is that I use it very often. The 3 main use cases for me are:

1) Copying and pasting data from web pages often result in empty lines depending on how the original web page was organized; so removing these empty rows in a quick manner is very helpful

2) Sometimes working with long data tables I need to manually remove some lines. It is easier to simple remove their contents first (using Delete key) than using the Remove Row command (which shows a dialog, requiring more clicks). After removing all the rows, I simply compact the data table.

3) In lectures, I often use Calc to illustrate how a certain algorithm processes a matrix of data, which involves deleting rows one at a time. So what I do is simply delete the cell contents (using the Delete key) and at the end of the iteration I compact the data using this extension.

I understand that these uses cases may be a little "niche", which is why I developed it as an extension.

But if some day a dev wishes to implement this functionality into LO natively, I would be very pleased =)
Comment 10 Timur 2022-09-26 13:02:00 UTC
I also agree that a command would be useful. 
Working with rows/columns is a core Calc feature and a need may arise during regular user's work, regardless how often it will be used. 
I think it's much better to have it confirmed with Lowest Enh and info on extension than to close and for sake tell: no need for this in Calc.
Comment 11 Heiko Tietze 2023-05-25 08:44:03 UTC
We discussed the topic in the design meeting and agree with the requirement (have to withdraw my comment 8; removing empty rows is in fact a procedure I do myself quite often). An inbuilt function should be more convenient and faster than the extension.

The function should work on the selection, if any made, or the range with content and either remove empty rows (taking care of hidden cells) or empty columns. The command should be available on the context menu as well under the Sheet main menu.