Skip to main content

Get-All-Worksheet-Names

Command Description

Get the names of all worksheets under the specified Excel

Command Prototype

arrayRet = Excel.GetSheetsName(objExcelWorkBook)

Parameter Description

ParameterRequiredTypeDefaultDescription
objExcelWorkBookTrueexpressionobjExcelWorkBookExcel workbook object (workbook opened with "Open Excel" command (Excel.OpenExcel) or the workbook object returned by the command "Bind Excel" (Excel.BindBook))

return

arrayRet,The variable used to save the output of the command.

Demo

/********************Get all sheet names ************************ ****** 
**Incoming parameters:
** objExcelWorkBook--Excel workbook object (a workbook opened using the "Open Excel" command (Excel.OpenExcel) or a job bound using the "Bind Excel" command (Excel.BindBook) book object).
**Exports:
** arrayRet--The variable to which the output of the function call is saved.
**
*********************************************************************/

objExcelWorkBook = Excel.OpenExcel(@res"Test.xlsx",True,"Excel","","")
arrayRet = Excel.GetSheetsName(objExcelWorkBook)
TracePrint "Get all worksheet names: All worksheet names of the Excel object have been obtained, as: "
TracePrint arrayRet
Excel.CloseExcel(objExcelWorkBook,False)