是否可以使用 openpyxl 更改列宽? [英] Is it possible to change the column width using openpyxl?

查看:124
本文介绍了是否可以使用 openpyxl 更改列宽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 xlsx 格式的电子表格.对于每一列,我需要将除一列之外的所有列的列宽设置为 25,并将其余列的宽度设置为 50.测量单位是 一个 Excel 使用的独特之处.

I have xlsx format spreadsheets. For each one I need to set the column width for all but one column to 25 and the width of the remaining column to 50. The unit of measurement is the idiosyncratic one Excel uses.

电子表格最初是在 Google 表格中生成的,无法执行此操作,因此目前我必须以 xlsx 格式下载它们,然后通过电子邮件将它们发送给拥有 Excel 的朋友以修复它们,因为我没有副本Excel 本人.这显然远非理想.

The spreadsheets are originally produced in Google sheets which has no way to do this so currently I have to download them in xlsx format and then email them to a friend who has Excel to have them fixed as I don't own a copy of Excel myself. This is clearly far from ideal.

是否可以使用 openpyxl 设置列宽?

Is it possible to set the column widths using openpyxl?

推荐答案

Openpyxl 列宽

ws.column_dimensions['A'].width = 25

这篇关于是否可以使用 openpyxl 更改列宽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆