Categories
Welcome Center
Education & Development
Discussions
Certification Preparation
Recent Posts
Groups
Free Resources
Ebooks
Free Workshops
Trending Certifications Infographic
Infosec Training
IT & Security Training
Live Boot Camps
Security Awareness Training
About Infosec Institute
Home
Discussions
Off Topic
PowerShell + Excel Culumns Formating
RobertKaucher
I've created a nice powershell script that extracts data from a SQL Server view, manipulates it, and then places it into Excel. I fave figured out how to set attributes on the columns like the width, but I do not know how to set the column format to currency or date for example.
Any ideas?
Find more posts tagged with
Save $250 on 2025 certification boot camps from Infosec!
Book now with code EOY2025
Button
Comments
RobertKaucher
I'm thinking it must be some property of
$worksheet
.
columns
.item(
'a'
).
But I am clueless...
RobertKaucher
I just recorded a macro and hacked the code from that.
$worksheet
.columns.item(
'd'
).NumberFormat
=
"$#,##0.00"
$worksheet
.columns.item(
'c'
).NumberFormat
=
"m/d/yyyy"
blargoe
Cool... thanks for sharing
HeroPsycho
You may want to checkout PowerTabs down the road. It allows for more easy discoverability for various .net objects. The author is also looking to add the same functionality to COM objects in the future.
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
INFOSEC Boot Camps
$250
OFF
Use code
EOY2025
to receive $250 off your 2025 certification boot camp!
BROWSE BOOT CAMPS