-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcsv2xlsx.py
35 lines (33 loc) · 884 Bytes
/
csv2xlsx.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from math import e
import os
import sys
import csv
from xlsxwriter import worksheet
from xlsxwriter.workbook import Workbook
conferences=["AAAI",
"CVPR",
"ICCV",
"ECCV",
"ICLR",
"ICML",
"IJCAI",
"NIPS",]
workbook=Workbook("Collector.xlsx")
total=workbook.add_worksheet("Total")
count=0
for i,con in enumerate(conferences):
sheet=workbook.add_worksheet(con)
papers=[]
print("NAME: ",con)
with open(con+".csv","r",encoding="utf-8") as f:
reader=csv.reader(f)
try:
for r,row in enumerate(reader):
if not row or not len(row[0]): continue
for c,cell in enumerate(row):
sheet.write(r,c,cell.replace("\n",""))
total.write(count,c,cell)
count+=1
except BaseException as e:
print("ERROR in {},{}: {}".format(r,c,repr(e)))
workbook.close()