Skip to content

Instantly share code, notes, and snippets.

@se1exin
Created June 3, 2017 03:30
Show Gist options
  • Save se1exin/2a599e4fec8c62b84102b16eabec7780 to your computer and use it in GitHub Desktop.
Save se1exin/2a599e4fec8c62b84102b16eabec7780 to your computer and use it in GitHub Desktop.
Macro for LibreOffice Calc - Export all sheets to CSV
REM ***** BASIC *****
Sub Sheets_To_CSV
sheets=ThisComponent.Sheets.createEnumeration()
sURL = ThisComponent.getURL()
oView = ThisComponent.getCurrentController()
while sheets.hasMoreElements()
sh=sheets.nextElement()
s=sh.getName()
if sh.IsVisible then
oView.setActiveSheet(sh)
StoreCSV sURL &"_"& s &".csv"
endif
wend
End Sub
sub StoreCSV(sURL As String)
dim document as object
document = ThisComponent
dim args(1) as new com.sun.star.beans.PropertyValue
args(0).Name = "FilterName"
args(0).Value = "Text - txt - csv (StarCalc)"
args(1).Name = "FilterOptions"
args(1).Value = "44,34,76,1"
document.storeToURL(sURL,args)
end sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment