Reading from EXCEL in MAC Operating System

Asked by Santhosh Motamarry

Hi Raiman,

I am using Sikuli tool in MAC.

There is a scenario where I need to pass multiple user's first name and last name while registering in a site. Could you please tell me whether I can pass the multiple data through excel sheet. For that i am trying a simple program to open excel sheet.

I have downloaded the package xlrd and placed it one folder. please find the path below where i placed my xlrd in my mac.

/Users/suresh/Desktop/Sikuli Scripts/Lib/xlrd

and i tried to open an excel sheet which i placed on the desktop.

but iam unable to open it it is showing some issue. please help me from this.

my code.

import xlrd
book=xlrd.open_workbook("/Users/suresh/Desktop/Sikuli Scripts/book1.xls")

error: importerror: no module named xlrd.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Santhosh Motamarry
Solved:
Last query:
Last reply:
Revision history for this message
Mikeldi Latorre (magodiez) said :
#1

maybe you need to download the xlrd library??? http://pypi.python.org/pypi/xlrd

Revision history for this message
RaiMan (raimund-hocke) said :
#2

@ Mikeldi

I guess this is already done.

@ Santosh

It seems that the path to xlrd is missing in sys.path:

xlrdPath = "/Users/suresh/Desktop/Sikuli Scripts/Lib/xlrd"
if not xlrdPath in sys.path: sys.path.append(xlrdPath)
import xlrd
book=xlrd.open_workbook("/Users/suresh/Desktop/Sikuli Scripts/book1.xls")

BTW: I recommend, to not use blanks in the folder names (like ...Desktop/Sikuli Scripts/...). This might lead to problems in some special situations.

Revision history for this message
Santhosh Motamarry (santhosh-motamarry) said :
#3

Hi Raiman,

still iam facing issue. after trying with your way of concern i am facing an issue as follows

syntaxerror: ("mismatched input import expecting indent")

and with ur recommended line in last as i am using mac i just copied directly the excel sheet on the desktop of my mac and i have given the path (since mac will be having only macinthosh HD)

Revision history for this message
Santhosh Motamarry (santhosh-motamarry) said :
#4

Hi Raiman,

I have seen a library folder in mac i have copied the xlrd their and tried even still it is showing an issue.

Revision history for this message
Santhosh Motamarry (santhosh-motamarry) said :
#5

hey can please answer my question

Revision history for this message
RaiMan (raimund-hocke) said :
#6

--- "hey can please answer my question"

You cannot talk with me this way - I am not your servant.

This was my last answer on your questions.

BTW: the above error situations have nothing to do with Sikuli - it is simple basic knowledge of Python/Jython and path names.

Good bye.

Revision history for this message
Santhosh Motamarry (santhosh-motamarry) said :
#7

hi raiman,

i am extremely sorry for my comments