How to write multiple rows in excel through sikuli?

Asked by Sneha Pandey

Hello,

I have run a master script to run multiple sikuli scripts and log the individual script execution results into a text file. I want to write the execution results of all the scripts into an excel/csv file(in separate columns)?
Please help me out.

Regards

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

The easiest way might be, to structure your textfile as a csv file, that you might open with excel.

The Python csv module (http://docs.python.org/library/csv.html) has some support for that.

The more complex possibility is the xlwt module (http://pypi.python.org/pypi/xlwt), where you can write directly into an excel file.

Revision history for this message
Sneha Pandey (sneha-uk17) said :
#2

Hi RaiMan,

Thank you so much.
It's done. I tried both the options and they worked great.

I must appreciate your time and effort to solve the queries.

Thanks Again!!!

Sneha

Revision history for this message
Sneha Pandey (sneha-uk17) said :
#3

Thanks RaiMan, that solved my question.

Revision history for this message
karthik (vkarthik-1233) said :
#4

Hi Sneha Pandey,
I am working on Sikuli. Are you able to write into excel sheet from sikuli? When I try to run the below script

import xlwt
book = xlwt.Workbook(encoding="utf-8")
sheet1 = book.add_sheet("PythonSheet1")
print (sheet1)
sheet1.write(0, 0, "This is the First Cell of the First Sheet")
book.save("python_spreadsheet.xls")

I am getting the follwoing msg

[sikuli] Stopped
[sikuli] An error occurs at line 1
[sikuli] Error message:
Traceback (most recent call last):
  File "/tmp/sikuli-tmp950690561952153752.py", line 1, in <module>
    import xlwt
ImportError: No module named xlwt

But when I try to run this in normal i.e., without using sikuli it's working fine.

Please help me
Thanks in advance

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

@ karthik
you must either tell Sikuli via sys.path where to find xlwt or put xlwt in a place, that is already in sys.path and hence known to Sikuli.

Revision history for this message
Ajit (ajitjadhav896) said :
#6

Can you Explain in Detail.
Regarding Adding External Libraries and use them into Sikuli IDE.
please Help.

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

@Ajit
see faq 2208
... read to the end!

Revision history for this message
Ajit (ajitjadhav896) said :
#8

@RaiMan

Hello RaiMan,

Now I am able to Create,Write and Read Excel File.

Thanks.
Ajit.