Advertisement
mayankjoin3

Untitled

Nov 14th, 2022
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. # importe required libraries
  2. import openpyxl
  3. import csv
  4. import pandas as pd
  5.  
  6. # open given workbook
  7. # and store in excel object
  8. excel = openpyxl.load_workbook("qr_names_input.xlsx")
  9.  
  10. # select the active sheet
  11. sheet = excel.active
  12.  
  13. # writer object is created
  14. col = csv.writer(open("qr_names_input.csv",
  15. 'w',
  16. newline=""))
  17.  
  18. # writing the data in csv file
  19. for r in sheet.rows:
  20. # row by row write
  21. # operation is perform
  22. col.writerow([cell.value for cell in r])
  23.  
  24.  
  25. # with open("qr_names_input.csv", "r") as f:
  26. # rows = f.readlines()[1:]
  27.  
  28. # print(rows)
  29.  
  30. # with open('qr_names_input.csv', 'w') as fout:
  31. # fout.writelines(rows)
  32.  
  33. # import pandas as pd
  34.  
  35. # read_file = pd.read_excel (r'qr_names_input.xlsx', sheet_name='Sheet1', engine='openpyxl')
  36. # read_file.to_csv (r'qr_names_input.csv', index = None, header=False)
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement