How to validate the worksheet name / file name of Excel and CSV files in WATiR?

Because if we save the CSV file in with different name, the worksheet name will also change while in Excel it will remain the same.

How we can find the File name if we will open the file?

  • 2
    Do you have a piece of code to demonstrate what you are working on?
    – dzieciou
    Commented Jan 23, 2013 at 7:27

2 Answers 2


Although I haven't had to do this in a few years, I always found the win32OLE to be my best friend in these cases. Can't seem to find any of my old code samples. Doing a quick search, I came across a fairly good tutorial here by David Sulc with this particular post seeming to cover exactly what you're looking for.


Watir drives browsers. Since you are using Watir my guess is that you are using Ruby. If you need to access Excel files you will have to use another tool, roo for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.