#Excel turn CSV, One sheet Save the table in a CSV In the file , And sheet Naming
import pandas as pd
def xlsx_to_csv_pd():
#sheet_name=None Read all sheet, perhaps sheet_name=[0,10], This is used here sheet_name, Instead of using sheetname
data_xls =
pd.read_excel(‘C:\Users\Administrator\Desktop\test\1.xlsx’,sheet_name=None,index_col=0)
for key in data_xls:
data_xls[key].to_csv(‘C:\Users\Administrator\Desktop\test\’+key+’.csv’,
encoding=‘utf-8’)
if name == ‘main’:
xlsx_to_csv_pd()
#csv turn Excel
import pandas as pd
def csv_to_xlsx_pd():
csv = pd.read_csv(‘C:\Users\Administrator\Desktop\test\1.csv’,
encoding=‘utf-8’)
csv.to_excel(‘C:\Users\Administrator\Desktop\test\2.xlsx’, sheet_name=‘data’)
if name == ‘main’:
csv_to_xlsx_pd()
Technology