Inserting text from text file into existing Excel worksheet with PowerShell
<p>I'm trying to insert the contents of my text file into cell A1 on Sheet1 but all I get is the filename inserted instead of the contents of the text file.</p>

<pre><code>$Path = 'C:\folder\Test.xlsx'
$Text='C:\folder\text.txt'
# Open the Excel document and pull in the 'Play' worksheet
$Excel = New-Object -Com Excel.Application
$Excel.Visible=$true #For troubleshooting purposes only.

$Workbook = $Excel.Workbooks.Open($Path) 
$page = 'Sheet1'
$ws = $Workbook.worksheets | where-object {$_.Name -eq $page}
# Set variables for the worksheet cells, and for navigation

$cells=$ws.Cells
$row=1
$col=1
$cells.item($Row,$col)=$Text
$col++
# Close the workbook and exit Excel
$workbook.Close($true)
$excel.quit()
</code></pre>