我试图使用Python将xlsb
文件转换为xlsx
,但在所有失败的尝试中都无法解决问题。
代码:
import pandas as pd
import os
import glob
source='C:\\Users\\JS Developer\\sample.xlsb'
dest= 'C:\\Users\\JS Developer\\Desktop\\New folder'
os.chdir(source)
for file in glob.glob("*.xlb"):
df.to_csv(dest+file+'.csv', index=False)
os.remove(file)
for file in glob.glob("*.xlsb"):
df = pd.read_excel(file)
df.to_csv(dest+file+'.csv', index=False)
os.remove(file)
答案 0 :(得分:0)
一旦您阅读了Excel并将其存储在pandas数据框中,将其另存为
df.to_excel(r'Path\name.xlsx')
尝试:
for file in glob.glob("*.xlsb"):
df = pd.read_excel(file)
df.to_excel(dest+file+'.xlsx', index = None, header=True)
os.remove(file)