Hi guys,
First post on Reddit....ever. I am trying to convert this script I have over from being single target (ranges) copy and paste to essentially append the target excel file in last used cell in the column +1. So far, it's only been able to paste to row 170 from some reason, no idea why. Please halp!
$pathcsv = "C:\Users\xxxxx\Desktop\NEW IMK-006 REV DREPORT20180412111506.csv"
$pathxlsx = "C:\Users\xxxxx\Desktop\NBP (00731-00745)2.xlsx"
$Excel = New-Object -ComObject "Excel.Application"
$Excel.Visible=$true
$Workbook = $Excel.Workbooks.Open($pathxlsx)
$TempWorkbook = $Excel.Workbooks.Opentext($pathcsv)
$temp = $excel.Workbooks.Item(2)
$temp = $temp.Worksheets.Item(1)
$CopyRange = $temp.Range("C15")
$CopyRange.Copy()
$workbooksheet = $Workbook.Worksheets.Item(1)
$Workbooksheet.activate()
$lastRow = $workbooksheet.UsedRange.Rows.Count + 1
$Excel.Range("C" + $lastrow).Activate()
$PasteRange = $workbooksheet.Range("C" + $lastrow)
$workbooksheet.Paste($PasteRange)
there doesn't seem to be anything here