File tree Expand file tree Collapse file tree 1 file changed +1
-34
lines changed
Expand file tree Collapse file tree 1 file changed +1
-34
lines changed Original file line number Diff line number Diff line change 3232
3333
3434workbook .save (ename )
35- file .close ()
36-
37- csv_name = input ("Name of the input CSV file with extension: " )
38- sep = input ("Separator of the CSV file: " )
39- ename = input ("Name of the output excel file with extension: " )
40- sname = input ("Name of the output excel sheet: " )
41- try :
42- workbook = openpyxl .load_workbook (ename )
43- sheet = workbook .get_sheet_by_name (sname )
44-
45- file = open (csv_name , "r" , encoding = "utf-8" )
46- except :
47- print ("Error: File not found" )
48- sys .exit ()
49- excel_row = 1
50- excel_column = 1
51-
52- for lines in file :
53-
54- lines = lines [:- 1 ]
55- lines = lines .split (sep )
56-
57- for dat in lines :
58-
59- sheet .cell (excel_row , excel_column ).value = dat
60-
61- excel_column += 1
62-
63- excel_column = 1
64- excel_row += 1
65-
66-
67- workbook .save (ename )
68- file .close ()
35+ file .close ()
You can’t perform that action at this time.
0 commit comments