Read data from excel sheet in python

0 votes

How to Read data from excel sheet in python. how to read data from excel sheet in selenium python framework?

Below is my code:

def getcell(rows,cols):

table=list()

record=list()

for x in range(rows):

    for y in range(cols):

        record.append(SheetName.cell(x,y).value)    

        table.append(record)

        record=[]

        rows=rows+1

return table;

print(table)
Jun 28, 2018 in Selenium by Martin
• 4,320 points
3,724 views

1 answer to this question.

0 votes

Try to use xrld. A python module used to read MS excel sheets.

This example will help you:

import xlrd

book = xlrd.open_workbook("myfile.xls")

print "The number of worksheets is", book.nsheets

print "Worksheet name(s):", book.sheet_names()

sh = book.sheet_by_index(0)

print sh.name, sh.nrows, sh.ncols

print "Cell D30 is", sh.cell_value(rowx=29, colx=3)

for rx in range(sh.nrows):

    print sh.row(rx)

answered Jun 28, 2018 by Samarpit
• 5,910 points

Related Questions In Selenium

0 votes
1 answer

How can we read data from an excel sheet in Selenium webdriver?

Hi Tarun, to read data from an ...READ MORE

answered May 8, 2019 in Selenium by Abha
• 28,140 points
17,590 views
0 votes
1 answer
0 votes
1 answer

How can I read numeric data from an Excel sheet using Selenium Webdriver?

Hey Jignesh, for reading numeric data from ...READ MORE

answered Jul 17, 2019 in Selenium by Abha
• 28,140 points
8,212 views
0 votes
0 answers
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,732 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,171 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,248 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,887 views
0 votes
1 answer

Error in for loop to fetch data from excel in selenium

You are closing theFileInputStream inside the for-loop. ...READ MORE

answered Jun 20, 2018 in Selenium by Samarpit
• 5,910 points
3,958 views
+1 vote
1 answer

How to handle notifications in Python with Selenium (Chrome WebDriver)

Below will help you: You can disable the ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
14,462 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP