Forum Discussion
Philip_Baird
11 years agoCommunity Expert
Hi ganapati, your code is failing because Sheets is a property of the Excel object, not the Excel.Workbooks object.
The following code will:
1. Open an Excel Workbook.
2. Select the "PersonalInformationData" Sheet.
3. Select the Cell "A1" and Log the value contained in that Cell.
var Filepath = "E:\\temp\\test.xlsx";
var Excel = Sys.OleObject("Excel.Application");
Excel.Workbooks.Open(Filepath);
Excel.Sheets( "PersonalInformationData" ).Select();
Excel.Range( "A1" ).Select();
Log.Message( Excel.ActiveCell.Value2 );
}
Hope this helps.
Regards,
Phil Baird
The following code will:
1. Open an Excel Workbook.
2. Select the "PersonalInformationData" Sheet.
3. Select the Cell "A1" and Log the value contained in that Cell.
function testExcel() {
var Filepath = "E:\\temp\\test.xlsx";
var Excel = Sys.OleObject("Excel.Application");
Excel.Workbooks.Open(Filepath);
Excel.Sheets( "PersonalInformationData" ).Select();
Excel.Range( "A1" ).Select();
Log.Message( Excel.ActiveCell.Value2 );
}
Hope this helps.
Regards,
Phil Baird
Related Content
- 2 months ago
- 3 years ago
- 5 years ago
Recent Discussions
- 9 hours ago