How to Get Particular row of data from Excel using Python

  • 21 April 2020
  • 0 replies
  • 3 views

Product: Kryon RPA (Studio/Robot)

Product Version:19.1+

Components: Kryon Studio/Python

Article Status: Completed

 

Step1: Open CMD and navigate to folder where python installed inside Kryon Studio folder in my case it is >> C:Program FilesKryon StudioPython

 

Check Pic1

 

25732i129463C063CF6CCD.jpg

Step2: install "xlrd" package as follows

 

Note: if you are using python first time then it might ask you to upgrade first PIP then please do with following command:

python -m pip install --upgrade pip

 

Check Pic2

25733i4BC2890024E72E53.jpg

 

now type following command as follows:

python -m pip install xlrd

 

Check Pic3

25734i4BA5111C5B053835.jpg 

 

This will installed excel handling library in python. In my case it is already installed ?

 

Step 3: inside Kryon Studio, use Run Script as follows and use following python script

 

#Python scripts starts here

# Program to extract a particular row value 

import xlrd 

 

loc = ("path of file") 

 

wb = xlrd.open_workbook(loc) 

sheet = wb.sheet_by_index(0) 

 

sheet.cell_value(0, 0) 

 

print(sheet.row_values(1)) 

#Python scripts ends here

 

 Check Pic4

 25735i53868AEBBC8BD81D.jpg

 Check Pic5

25736iF56C0A151C92ABDC.jpg

Enjoy ?

 

Regards,

Zakir Khan


0 replies

Be the first to reply!

Reply