Forum Discussion
The articles, really, give everything you need to know, including sample code, for accessing an excel spreadsheet for reading directly and writing directly without needing to actually open the Excel application.
But it really comes down to what you are intending to do. What is in these spreadsheets that you want to use in your tests? How do you want to use them? What are you writing out and for what purpose? Let us know a bit more of your use case and we'll see what we can do to help with implementation.
- forrestaustin7 years agoContributor
So I have a workbook with multiple sheets. I would like to access different sheets to obtain object tags from various cells. Then when I run a test I would like to paste values such as 'Pass' or errors into certain cells.
I looking at the following code from the TestComplete documentation:
def ReadDataFromExcel(): Excel = Sys.OleObject["Excel.Application"] Excel.Workbooks.Open("C:\\Work\\TestBook.xls") RowCount = Excel.ActiveSheet.UsedRange.Rows.Count ColumnCount = Excel.ActiveSheet.UsedRange.Columns.Count
Some of my confusion was how to navigate to a specific sheet. Now that I am looking at it again is it just as simple as replacing the "ActiveSheet" from the code with the name of the sheet I am actually referring to?
I am also trying to figure out how to represent specific cells as a range object. For example lets say I want to take the values from cells 5E, 6E,7E....20E. It looks like I need a way of representing those as a range object but I am a little confused how I would do that.