How to extract a all sheet name in libreoffice calc?

My libreoffice calc document contains more than 100 sheets. I want to get all the sheet name. I have tried (F5) navigator then drag option.Is there any other easy way available to extract all the sheet name?
Please help me to solve this issue.

Create a new sheet named “Sheet List” at the end of all your existing sheets. Post that, configure the given macro and execute it. You will get the all the sheet names in “Sheet List” sheet.

Sub ListSheetNames
   Dim oSheet As Object
   Dim oNewSheet As Object
   oNewSheet = ThisComponent.Sheets.getByName("Sheet List")
   If IsNull(oNewSheet) Then
      oNewSheet = ThisComponent.Sheets.getByName("Sheet1").copy(ThisComponent,ThisComponent.Sheets.getCount)
      oNewSheet.Name = "Sheet List"
   End If
   oRow = 0
   For Each oSheet In ThisComponent.Sheets
      oRow = oRow + 1
      oNewSheet.getCellByPosition(0,oRow).setString(oSheet.Name)
   Next
End Sub
2 Likes

ThankYou. It is working.

Could you please explain what is macro and why we are using this kind of code?
It is very new to me. Previously I had worked with Excel. Now only I have started using Libreoffice calc.

https://help.libreoffice.org/latest/lo/text/sbasic/shared/main0601.html?DbPAR=BASIC

இங்கே பார்க்கவும்.

1 Like

Thank you