Need help writing a powershell script

Alex Weakley 1 Reputation point
2021-09-02T19:52:42.077+00:00

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
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,435 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Alex Weakley 1 Reputation point
    2021-09-02T19:53:21.78+00:00

    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 {}