我有这个问题。我必须从Mac电脑(OSX)部署我的Django项目。但我得到了这个错误: 没有名为win32com的模块 有没有一种方法或替代图书馆
这就是我需要它的地方: 视图.py
excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.Visible = True
ex = excel.Workbooks.Open(save_path)
ex_sheet = ex.Worksheets('Finansal Tablolar_formul')
ex_sheet.Columns.AutoFit()
ex_sheet_2 = ex.Worksheets('Finansal Tablolar_formul')
ex_sheet_2.Columns.AutoFit()
ex.Save()
ex.Close(True)
excel.Application.Quit()
基本上,我需要它自动适应(更大的)细胞
查看此库
openpyxl
https://openpyxl.readthedocs.io/en/stable/
阅读手册的简单用法:
在您的情况下,应该使用
openpyxl.utils.get_column_letter
自动拟合单元格你可以看看下面的答案
https://stackoverflow.com/a/40935194/10515127
相关问题 更多 >
编程相关推荐