Powershell - Excel Change format of the column to Text

落爺英雄遲暮 提交于 2021-02-04 16:31:58

问题


I have to convert 2 columns in 20 excel files (same format) everyday. Is there a way in powershell to make it work. I searched for some examples but all point to change of Number format.

Current code:

$worksheet.columns.item('d').NumberFormat = "$#,##0.00" 

The entire Workbook / Worksheet is in "General" format

Help is appreciated.


回答1:


As per comments, you can use @ to specify text formatting:

$worksheet.columns.item('d').NumberFormat = "@"


来源:https://stackoverflow.com/questions/45632765/powershell-excel-change-format-of-the-column-to-text

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!