I want to convert a textfile to Excel Format. I use the following script from Technet:
# Script name: ConvertTilde.ps1
# Created on: 2007-01-06
# Author: Kent Finkle
# Purpose: How Can I Convert a Tilde-Delimited File to Microsoft Excel Format?
$s = gc C:\Scripts\Test.txt
$s = $s -replace("~","`t")
$s | sc C:\Scripts\Test.txt
$xl = new-object -comobject excel.application
$xl.Visible = $true
$wb = $xl.Workbooks.Open("C:\Scripts\Test.txt")
$wb.SaveAs(“D:\Excel\Test.xlsx”)
The Script works, excel opens and imports the txt, but the saved Files are just txt files renamed to xlsx - how can I get Excel to change the File Format?