Convert Excel (xls) with multiple sheets (tabs) to the individual CSV’s in in Linux environment via command line

Can we convert Excel (xls) with multiple sheets (tabs) to the individual CSV’s in in Linux environment via command line?

Please can you let us know if it is possible using libreoffice.

We are using libre office version 4.3.2

libreoffice --headless --convert-to csv “abc.xls”

soffice --headless --convert-to csv:“Text - txt - csv (StarCalc)”:“59,ANSI,1” “abc.xls”

Not sure if this can be done without macros, maybe someone else could give alternate answer.

To use a macro, from windows , but hopefully similar in Linux:-

"C:\Program Files\LibreOffice 5\program\soffice" --headless "Untitled 3.xls" "macro:///Standard.Module10.WriteCsvSheets()"

This will run the following basic macro from Standard Module10 in My Macros.

REM  *****  BASIC  *****

Option Explicit

Sub WriteCsvSheets()

	Dim oDoc As Object
	Dim oSheet As Object
	Dim Args(1) As New com.sun.star.beans.PropertyValue
	Dim sDirectory As String
	Dim sFileName As String
	
	oDoc = thisComponent
	
	sFileName = oDoc.Title
	sDirectory = replace(oDoc.Location, "%20", " " )	'	Allow for spaces in name as %20
	sDirectory = replace(sDirectory, sFileName, "" )
	
	sFileName = left(sFileName, instr(sFileName,".") - 1)
	
	For Each oSheet in oDoc.Sheets
		'	Make the sheet active
		oDoc.getcurrentController.setActiveSheet(oSheet)
		
'		msgbox "test calling macro from command line" & chr(10) & oSheet.name		'	Debug only
		
		Args(0).Name = "FilterName"
		Args(0).Value = "Text - txt - csv (StarCalc)"
		Args(1).Name = "Overwrite"
		Args(1).value = false
		
		On Error Resume Next
		oDoc.storeAsURL( sDirectory & sFileName & "_" & oSheet.name & ".csv", Args)
		On Error Goto 0
	Next oSheet
	
	thisComponent.Close(true)
End Sub