![](/img/trans.png)
[英]How to create a checkbox with value with Python using gspread and gspread_formatting
[英]Separating thousands using gspread formatting
我有一个数字值,我试图使用 gspread 和 gspread_formatting 在 google 表格中将其格式化为带有千位分隔符的货币:
A
151644
56464
所需的 output 应如下所示:
A
£ 151,644
£ 56,464
我试过:
worksheet.format('A', {'numberFormat': {'type' : 'CURRENCY', 'pattern': '£#.##0.'}})
worksheet.format('A', {'numberFormat': {'type' : 'CURRENCY', 'pattern': '£###. ###0'}})
worksheet.format('A', {'numberFormat': {'type' : 'CURRENCY', 'pattern': '£#.###'}})
worksheet.format('A', {'numberFormat': {'type' : 'CURRENCY', 'pattern': '£#.#'}})
worksheet.format('A', {'numberFormat': {'type' : 'CURRENCY', 'pattern': '£###'}})
没有一个返回预期的结果,我找不到有关格式模式的文档以具有一千个分隔符。
我如何使用gspread_formatting
package 实现此目的?
关于How could I achieve this using gspread_formatting package?
,在这种情况下,下面的示例脚本怎么样?
format_cell_range(worksheet, 'A', cellFormat(numberFormat={'type': 'CURRENCY', 'pattern': '£ #,###'}))
我能够使用以下方法实现格式:
worksheet.format('A',
{'numberFormat':
{'type' : 'CURRENCY', 'pattern': '£ #,###'}})
不确定这是否是理想的格式,但它可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.