1

I need to convert a lot of XLSX files to CSV, but each file has tabs, which must be converted to individual files if they have data in them.

In addition, I need to convert only those tabs that follow a pattern in their name, for example, "Tab1".

So far, I have managed to batch convert the files, although it only prints the first tab, using the ssconvert utility:

find. -name '* .xlsx' -exec ssconvert -T Gnumeric_stf: stf_csv {} \;

But when I try to add the tabs flag (-S) or the flag to include those tabs with a pattern (-I), I only get the following message:

find. -name '* .xlsx' -exec ssconvert -S -I tab1 -T Gnumeric_stf: stf_csv {} \;

An output file name or an explicit export type is required.

How do I do this correctly?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
RafaV
  • 21
  • 3
  • What if you remove `-I`? According to [what I find](http://manpages.ubuntu.com/manpages/bionic/man1/ssconvert.1.html), it seems to mean something different than "include only specific tabs". – mkrieger1 Feb 25 '20 at 16:37
  • `-name '* .xlsx'` - your files have a space before extension? – KamilCuk Feb 26 '20 at 11:09

1 Answers1

1

I just found the solution, I leave it here in case someone finds it useful. In the end I created a small script that performs the actions:

#!/bin/bash

for i in *.xlsx; do
    nombre=${i:0:${#i}-5};
    name="$nombre-%n-%s.csv";
    ssconvert --export-type=Gnumeric_stf:stf_csv --export-file-per-sheet $i $name; 
done
echo "Finish!"
mkrieger1
  • 19,194
  • 5
  • 54
  • 65
RafaV
  • 21
  • 3