forked from chenguohui/AutomatePython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexcelToCsv.py
More file actions
22 lines (17 loc) · 729 Bytes
/
Copy pathexcelToCsv.py
File metadata and controls
22 lines (17 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import csv
import os
import openpyxl
for excelFile in os.listdir('.'):
# Skip non-xlsx files, load the workbook object
for sheetName in wb.get_sheet_names():
# Loop through every sheet in the workbook
sheet = wb.get_sheet_by_name(sheetname)
# Create the CSV filename from the Excel filename and sheet title
# Create the csv.writer object for CSV file.
# Loop through every row in the sheet.
for rowNum in range(1, sheet.max_row+1):
rowData = []
for colNum in range(1, sheet.max_column+1):
# Append each cell's data to rowData
# Write the rowData list to the CSV file.
csvFile.close()