Forum Discussion
chriscc
Contributor
Hi Vicky,
I’m not well versed in Python, but you should be able to declare the range like this:
Range = Excel.ActiveSheet.Range("A2:C3")
So, the sample code would be something like this...changes are in bold.
Excel = Sys.OleObject["Excel.Application"]
Excel.Workbooks.Open("C:\\MyFile.xlsx")
Range = Excel.ActiveSheet.Range("A2:C3");
##whatever range you need…I used A2 to C3
for i in range(1, Range.Rows.Count + 1):
s = "";
for j in range(1, Range.Columns.Count + 1):
s = s + VarToString(Excel.Cells.Item[i, j]) + '\r\n'
Log.Message("Row: " + VarToString(i), s);
Excel.Quit();
Related Content
- 4 years ago
Recent Discussions
- 2 days ago
- 2 days ago
- 5 days ago