[英]Get cell to show as string in excel
I have a cell which shows the following: 我有一个显示以下内容的单元格:
00002
This is a string identifier and not a number. 这是一个字符串标识符,而不是数字。
However, when I click on the cell, it treats it as a number. 但是,当我单击该单元格时,它将其视为数字。 It says "2" in the text input at the top (next to the formula).
它在顶部的文本输入中(公式旁边)说“ 2”。
How would I convert this to be a string? 我如何将其转换为字符串? If I do cell formatting as Text, it strips all the leading zeros and incorrectly turns it into "2".
如果我将单元格格式设置为“文本”,它将去除所有前导零,并将其错误地变成“ 2”。 Right now it is formatted as a zip code.
现在,它已被格式化为邮政编码。
How do I make it a string, such that I can grab the value "00002" using xlrd? 如何将其设置为字符串,以便可以使用xlrd获取值“ 00002”?
Under Format Cells option in the Number tab. 在“数字”选项卡的“设置单元格格式”下。 Change the category to 'Text'.
将类别更改为“文本”。
Is the cell set to a custom format of 00000 ? 单元格是否设置为00000的自定义格式? If so, you can convert it by using a formula:
如果是这样,您可以使用以下公式将其转换:
=TEXT(A1,"00000")
Then copy -> paste-special -> values 然后复制->粘贴特殊->值
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.