paste numeric value from excel cell to notepade

Asked by SAMIRAN SARMA

I am new in Sikuli. My code is
import xlrd
file_loc="C:\Users\Samiran_PC\Desktop\excel example\zone-change.xlsx"
workbook=xlrd.open_workbook(file_loc)
sheet=workbook.sheet_by_index(0)
totalrow=sheet.nrows
totalcol=sheet.ncols
celltype=sheet.cell_type(2,0)
value=sheet.cell_value(2,0)
openApp("notepad")
wait(5)
value1=str(value)
paste(value1)

now on the cell (2,0) it contains a 9 digit number without any decimal point. but when it paste the value on note pad it contains a decimal point as 342019852.0 .how can i paste the value without decimal point?

Question information

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

[If you do not always need a decimal part]

paste(int(value1))

Revision history for this message
SAMIRAN SARMA (samiranmir) said :
#2

if i use paste(int(value1)) it shows the error "[error] ValueError ( invalid literal for int() with base 10: '300938199.0' )"

Revision history for this message
Best masuo (masuo-ohara) said :
#3

Sorry , try this codes.

value1=str(int(value))
paste(value1)

Revision history for this message
SAMIRAN SARMA (samiranmir) said :
#4

Thanks masuo, that solved my question.