'Iterate through the spreadsheets in a file and save each to a ' $filename/$sheet_name.csv oDocSheets = StarDesktop.CurrentFrame.Controller.Model.Sheets For i = 0 To oDocSheets.Count-1 'retrieve sheet reference, set as active sheet oSheet = oDocSheets(i) ThisComponent.CurrentController.setActiveSheet(oSheet)