powershell sort in excel sheet

Posted on 2014-09-10
Last Modified: 2014-09-12
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['C2010'] = @{}
$map['XC'] = @{}

$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

Question by:Mandy_
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

Mandy_ earned 0 total points
ID: 40319637
$map['C2010'] = @{}

Author Closing Comment

ID: 40319638
thats all i need

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question