Domanda

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..

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top