我尝试使用 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)
最佳答案
读取 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)
关于python - 我可以使用 python 将 xlsb 文件转换为 xlsx 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59558961/