LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I'm using Spreadsheet::WriteExcel to visualize the results of filtering multiples CSV.

I'm able to set autofilters (Dropdowns to limit columns by entries) and filter_column

according to https://metacpan.org/pod/Excel::Writer::XLSX#filter_column(-$column,-$expression-) (other module from same author with identical documentation)

> NOTE: It isn't sufficient to just specify the filter condition. You must also hide any rows that don't match the filter condition. Rows are hidden using the set_row() visible parameter. Excel::Writer::XLSX cannot do this automatically since it isn't part of the file format. See the autofilter.pl program in the examples directory of the distro for an example.

What's irritating me is that when I filter manually inside gnumeric or libreoffice I can see the filtering still active after saving and reopening.°

Do I really need to hide all rows manually?

I can see that the filter_column settings reflect in the checkboxes of the dropdowns, is there a trick to trigger a spreadsheet program to apply the filtering?

edit

°) OK, after posting it occurred to me that saving from Excel/loffice/gnumeric must change the visibility for each row individually.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on (SOLVED) Triggering autofilter in Excel via Spreadsheet::WriteExcel resp. Excel::Writer::XLSX

Replies are listed 'Best First'.
Re: (SOLVED) Triggering autofilter in Excel via Spreadsheet::WriteExcel resp. Excel::Writer::XLSX
by footpad (Abbot) on Dec 02, 2021 at 12:50 UTC
    OK, after posting it occurred to me that saving from Excel/loffice/gnumeric must change the visibility for each row individually.

    I seem to recall that this depends partly on the file format, as certain formats don't support certain properties and/or settings. (CSV is notoriously limited.)

    Perhaps saving the persistent version separately from the production CSV would help? Sure, it's more steps, but if it saves effort for the export...?

    --f

      Thanks, I'll consider this.

      I also have a trick to trigger a Perl script from a spreadsheet, this could be used for a reprocess/reload mechanism. :)

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery