1234567891011121314151617181920 |
- # convert_xls_to_xlsx.py
- import pandas as pd
- import sys
- def convert_xls_to_xlsx(input_file, output_file):
- try:
- df = pd.read_excel(input_file, engine='xlrd')
- df.to_excel(output_file, index=False)
- print("SUCCESS") # 打印成功消息
- except Exception as e:
- print(f"ERROR: {e}") # 打印错误消息
- if __name__ == "__main__":
- if len(sys.argv) != 3:
- print("ERROR: Usage: python convert_xls_to_xlsx.py <input_xls_file> <output_xlsx_file>")
- sys.exit(1)
- input_file = sys.argv[1]
- output_file = sys.argv[2]
- convert_xls_to_xlsx(input_file, output_file)
|