Have Calc list the option to Save As Tab Separated Values?

When doing a Save As, the list of files types does not have a Tab Separated Values option. It would be nice if it did. I saw the post as follows, but it is not as intuitive as having a TSV option in the drop-down list.

Use File > Save a Copy.
Goto the place, where you want to save the file.
Choose the file type Text CSV (.csv) form the drop down list.
Uncheck Automatic file name extension and enter the file name including the correct filename extension. Check Edit filter settings. Click Save. Now you get a dialog for the settings.
In the drop-down list field delimiter select the item {Tab}.

“Feature requests should go directly to Bugzilla as Enhancements”
is quoted from here:

Direct link to bugzilla

I’m aware my comment to use Bugzilla doesn’t help.
As work-around I can only suggest to use a macro to handle your specific needs and bind it to some key.

Here’s the macro. Bind it to a key or toolbar.

Option Explicit

Sub ExportToTsv
	Rem Based on https://www.briankoponen.com/libreoffice-export-sheets-csv/
	Dim Document as Object
	Dim FileDirectory as String
	Dim Sheets as Object
	Dim Index as Integer
	Dim Filename as String
	Dim FileURL as String
    Document = ThisComponent
    Sheets = ThisComponent.Sheets
    Rem Use the global string tools library to generate a path to save each TSV
    FileDirectory = Tools.Strings.DirectoryNameoutofPath(document.getURL(), "/") & "/subdir/"
	MsgBox "Saving files to" &  FileDirectory
    Rem Set up a propval object to store the filter properties
    Dim Propval(1) as New com.sun.star.beans.PropertyValue
    Propval(0).Name = "FilterName"
    Propval(0).Value = "Text - txt - csv (StarCalc)"
    Propval(1).Name = "FilterOptions"
    Propval(1).Value ="9, 34, 0, 1, 1"   Rem ASCII 9 = tab  59 = ;  34 = "  44 = ,

    For Index = 0 to Sheets.Count - 1
        Rem For each sheet assemble a filename and save using the filter
        Rem Replace True with condition for sheet name(s), etc.
        If True Then
	        Filename = FileDirectory + "/" + Sheets(index).Name + ".tsv"
	        FileURL = convertToURL(Filename)
	        Document.StoreToURL(FileURL, Propval())
        End If
    Next Index

End Sub
1 Like