Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20755

How to select Excel sheet in python?

$
0
0

Hi,

From https://support.smartbear.com/viewarticle/69443/#_ga=1.128686159.2137448148.1449520310

I have python code to read Excel file:

 

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
for i in range(1, RowCount + 1):
s = "";
for j in range(1, ColumnCount + 1):
s = s + VarToString(Excel.Cells.Item[i, j]) + '\r\n'
Log.Message("Row: " + VarToString(i), s);
Excel.Quit();

 

However I didn't find API how to select a sheet for multiple sheet Excel file?   Please advice.

 

Thanks

Heather

 


Viewing all articles
Browse latest Browse all 20755

Trending Articles