question

AlexWeakley-0817 avatar image
0 Votes"
AlexWeakley-0817 asked RichMatheisen-8856 commented

Need help writing a powershell script

Hello,
I am brand new to Powershell and I have been handed a task to make a Powershell script that can do the following:
-sort the contents of an excel workbook
-create separate workbooks for each instance of the filtered criteria
-upload the new workbooks to Sharepoint

I was able to find a script that someone was working on previously but its broken. not sure how much info I can share so I took out the criteria names and replaced them with generic placeholders.

directory path


$csvtemp = ".\xxxx.csv"
$UniquexxList = Import-Csv -Path $xxxx, 'name', "name", 'name', 'name', 'name' | group -AsHashTable -Property
$x = $($xx."name")
$y = $($x)
$FileName = $(Get-Date -Format yyyyMMdd)
Try {
#Assign variables/path for Open object edit
$xl = $xxData.$($x) | Sort -Descending | Sort -Descending | Export-Csv -Path ""$xxx\$xReport.xlsx" -PassThru -NoNumberConversion
}
Catch {}

windows-server-powershell
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AlexWeakley-0817,
Welcome to Q&A forum!
Since the tag office-excel-itpro focuses on general issues about Excel client that are not related to this issue, I will remove it.
Thanks for your understanding!
Hope you can get a reply soon.

0 Votes 0 ·

1 Answer

AlexWeakley-0817 avatar image
0 Votes"
AlexWeakley-0817 answered RichMatheisen-8856 commented

not sure why it posted it like that.

directory path


$csvtemp = ".\xxxx.csv"
$UniquexxList = Import-Csv -Path $xxxx, 'name', "name", 'name', 'name', 'name' | group -AsHashTable -Property
$x = $($xx."name")
$y = $($x)
$FileName = $(Get-Date -Format yyyyMMdd)
Try {
#Assign variables/path for Open object edit
$xl = $xxData.$($x) | Sort -Descending | Sort -Descending | Export-Csv -Path ""$xxx\$xReport.xlsx" -PassThru -NoNumberConversion
}
Catch {}

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If you're posting code, use the "Code sample" editor. It's the icon 5th from the left (the one that says "101 010"), or use Ctrl+K.

The normal text editor screws up the code in some subtle (and sometimes not-so-subtle) ways.

FYI, a CSV (comma separated values) file isn't Excel. There are no worksheets, and it's just a text file with an agreed upon formatting convention.

0 Votes 0 ·