1. 程式人生 > 其它 >python讀取excel資料自動寫入jira系統

python讀取excel資料自動寫入jira系統

技術標籤:jira

import xlrd
import os

data = xlrd.open_workbook(u’C://Users//sven.pan//Desktop//客戶資訊3 .xls’, encoding_override=‘utf-8’)
table = data.sheets()[0] # 選定表
nrows = table.nrows # 獲取行號
ncols = table.ncols # 獲取列號

print(nrows)
print(ncols)
for i in range(1, nrows): # 第0行為表頭
alldata = table.row_values(i) # 迴圈輸出excel表中每一行,即所有資料

result = alldata[0] # 取出表中第1列資料
# print(result)
cmd = f’acli jira --action addCustomFieldOptions --field 客戶 --options {result} --server https://jira.com --user passwd --password 1314’
# print(cmd)

try:
    os.system(cmd)
except:
     print(cmd)