Skip to content

Instantly share code, notes, and snippets.

@yankchina
Created March 27, 2015 03:13
Show Gist options
  • Save yankchina/8bfe8e823d9fcb2cb513 to your computer and use it in GitHub Desktop.
Save yankchina/8bfe8e823d9fcb2cb513 to your computer and use it in GitHub Desktop.
根据 cell 的类型来获取值,并转换为字符串
def get_cell_value(sheet,row,col):
# Cell Types: 0=Empty, 1=Text, 2=Number, 3=Date,4=Boolean,5=Error,6=Blank
cell_type = sheet.cell_type(row,col)
if 1 == cell_type:
value = sheet.cell_value(row,col)
if 2 == cell_type:
value = u"%s" %(sheet.cell_value(row,col))
return value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment