I have this automation script that will take a .htm file and generate a custom object to be generated into a spreadsheet.
Unfortunately, one of the items in my object is a very long number, so when it does get exported to a .xlsx, it looks like this:
1.04511E+11
I understand that just changing the format to a number with no decimals is possible within Excel, but I wanted to know if there is a way I can change the format within my script; especially since this is intended to be an automated process.
Here is the segment of my script:
## Build custom object which allows for modification of the spreadsheet that will be generated
$xls = ForEach ($item in $spreadsheet | Where-Object {$PSItem.P4 -match '\w+'}) {
[pscustomobject]@{
## Define the colums for the CSV file
'MnsTransTy' = $item.P1.TrimStart()
'Del. Date' = $item.P2
'Time' = $item.P3
'Name 1' = $item.P4
'Purch.Doc.' = $item.P5
## Remove white space
'Cases' = $item.P6.TrimStart()
## Remove white space
'line' = $item.P7.TrimStart()
'Name' = $item.P8
## Remove white space
'Tot Pallet' = $Item.P9.TrimStart()
}
}
The item in question is P5. I am using the ImportExcel Module which is found here: https://github.com/dfinke/ImportExcel.
Any help on this would be greatly appreciated! Thanks in advance!