daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Oct 12th, 2017 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. import xlsxwriter
  3. import xlsxwriter
  4. import xlrd
  5. import os
  6. ticket = xlsxwriter.Workbook("output.xlsx")
  7. worksheet1=ticket.add_worksheet("Sheet 1")
  8. wb = xlrd.open_workbook("Siebel Ticket List new.xlsx")#input file
  9. sh = wb.sheet_by_index(0)
  10. wb1 = xlrd.open_workbook("lib.xlsx")#lib file
  11. sh1 = wb1.sheet_by_index(0)
  12.  
  13. worksheet1.write(0,11,"Keyword1")
  14. worksheet1.write(0,12,"Keyword2")
  15. worksheet1.write(0,13,"Outcome")
  16. worksheet1.write(0,14,"Business Impact")
  17. worksheet1.write(0,15,"Urgency")
  18. rownumber=3
  19. rownumber1=0
  20. try:
  21.     while sh.cell(rownumber,1).value != 0:
  22.         AA=sh.cell(rownumber,1).value
  23.         BB=sh.cell(rownumber,2).value
  24.         CC=sh.cell(rownumber,3).value
  25.         DD=sh.cell(rownumber,4).value
  26.         EE=sh.cell(rownumber,5).value
  27.         FF=sh.cell(rownumber,6).value
  28.         GG=sh.cell(rownumber,7).value
  29.         HH=sh.cell(rownumber,8).value
  30.         II=sh.cell(rownumber,9).value
  31.         JJ=sh.cell(rownumber,10).value
  32.         KK=sh.cell(rownumber,11).value
  33.         worksheet1.write(rownumber1,0,AA)
  34.         worksheet1.write(rownumber1,1,BB)
  35.         worksheet1.write(rownumber1,2,CC)
  36.         worksheet1.write(rownumber1,3,DD)
  37.         worksheet1.write(rownumber1,4,EE)
  38.         worksheet1.write(rownumber1,5,FF)
  39.         worksheet1.write(rownumber1,6,GG)
  40.         worksheet1.write(rownumber1,7,HH)
  41.         worksheet1.write(rownumber1,8,II)
  42.         worksheet1.write(rownumber1,9,JJ)
  43.         worksheet1.write(rownumber1,10,KK)
  44.         rownumber=rownumber+1
  45.         rownumber1=rownumber1+1
  46. except:
  47.     pass
  48. n=sh1.nrows#lib
  49. m=sh.nrows#data
  50. for n1 in range(n):
  51.     a1= sh1.cell(n1,0).value
  52.     a1=str(a1).encode("utf-8").lower()
  53.     a1a1= sh1.cell(n1,1).value
  54.     a1a1=str(a1a1).encode("utf-8").lower()
  55.     b1= sh1.cell(n1,2).value
  56.     b1=str(b1).lower()
  57.     d1= sh1.cell(n1,3).value
  58.     d1=str(d1).lower()
  59.     e1= sh1.cell(n1,4).value
  60.     e1=str(e1).lower()
  61.     for m1 in range(m):
  62.         c1= str(sh.cell(m1,6)).encode("utf-8").lower()
  63.         c1c1= str(sh.cell(m1,10)).encode("utf-8").lower()
  64.         if (a1 or a1a1) in (c1 or c1c1):
  65.             m2=m1-3
  66.             worksheet1.write(m2,11,a1)
  67.             worksheet1.write(m2,12,a1a1)
  68.             worksheet1.write(m2,13,b1)
  69.             worksheet1.write(m2,14,d1)
  70.             worksheet1.write(m2,15,e1)
  71. ticket.close()
RAW Paste Data
Top