Link to home
Start Free TrialLog in
Avatar of Mandy_
Mandy_

asked on

powershell sort in excel sheet

hi folks,

I've an csv looks like as follows:
action  Version
new      c2010
new      XC
delete  c2010
delete  XC

I wish to change the script that both at action new(xc,c2010) starts up at Cell 2 until Cell 150 and Action delete should
start at 155. Thats not the complete script only the important code.

$map=@{}
$map['C2010'] = @{}
$map['XC'] = @{}
$map['C2010']['New']=2
$map['XC']['New']=2
$map['C2010']['Delete']=155
$map['XC']['Delete']=155

$objExcel = New-Object -ComObject Excel.Application
$objExcel.Visible = $false
$WorkBook = $objExcel.Workbooks.Open($strXlsFile)
$worksheet = $workbook.sheets.item("CAS")

Import-Csv -Path $strCsvFile -Delimiter ';' | % {
	$ver = $_.version
	if (!($ver -eq '')) {	
		$aktion = $_.aktion
		$rowNum = $map[$ver][$aktion]
		$col = 1
		$_.PSObject.Properties | %{
			$worksheet.cells.item($rowNum,$col++) = $_.value
		}
		$map[$ver][$aktion] = $rowNum+1
	}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mandy_
Mandy_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mandy_
Mandy_

ASKER

thats all i need