Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. for item in list_documents:
  2. print("The item is: ", item)
  3. wb = openpyxl.load_workbook(path+item)
  4. sh = wb.get_active_sheet()
  5. split_item = item.split(".")[0]
  6. new_name = str(split_item) + ".csv"
  7. with open(path + new_name, 'w', newline="") as f:
  8. c = csv.writer(f, delimiter=";")
  9. counter = 0
  10. for r in sh.rows:
  11. counter += 1
  12. print(counter)
  13. c.writerow([cell.value for cell in r])
  14.  
  15. Traceback (most recent call last):
  16. File "C:/Users/aprofir/Desktop/python_project/transform_data/xlsx_to_csv.py", line 31, in <module>
  17. c.writerow([cell.value for cell in r])
  18. File "C:UsersaprofirAppDataLocalProgramsPythonPython37-32libencodingscp1252.py", line 19, in encode
  19. return codecs.charmap_encode(input,self.errors,encoding_table)[0]
  20. UnicodeEncodeError: 'charmap' codec can't encode character 'u0142' in position 173: character maps to <undefined>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement