I'm writing a script which imports a large csv file in Excel document. I try to use a faster way to enter the data and pass the array directly to Excel without looping it.
$p = Import-Csv -Path "C:\Report.csv" -Delimiter "`t"
$Excel01 = New-Object -ComObject Excel.Application 
$Excel01.Visible = $True 
$Workbook01 = $Excel01.Workbooks.Add() 
$Worksheet01 = $Workbook01.Sheets.Item(1) 
$Worksheet01.Activate() 
$Worksheet01.Range("A1:D1").EntireColumn.Value() = $p | select field1,field2...
But when I run this it hungs...How can I do that?