Question

Hi How can I fetch the name of first excel sheet in my excel file using the gem win32ole?? I want to validate an excel file based on the name of the first sheet..

I'm using ROR 3..

Was it helpful?

Solution

I got it! it was quite simple

WIN32OLE.ole_initialize
excel_app = WIN32OLE.new('Excel.Application')
workbook = excel_app.Workbooks.Open(path)
worksheet1 = workbook.Worksheets(1)
ws_name = worksheet1.name
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top