Link to home
Start Free TrialLog in
Avatar of namerg
namergFlag for United States of America

asked on

How to convert and xlsx spreadsheet into CSV ?

Hello,

How can I convert and xlsx spreadsheet into CSV ?

Thanks,
Avatar of BillBondo
BillBondo
Flag of United States of America image

Do a file save as other formats and choose csv.
Avatar of namerg

ASKER

jajajaj....buuu in Powershell ?
Try the following for a single file

# Excel file to convert
$xls = "C:\file1.xls";
# csv file to create
$csv = "C:\file1.csv";
 
Get-Content -Path $xls | Export-CSV -Path $csv -NoTypeInformation;
Avatar of namerg

ASKER

Hmm,

I have the following code and it pops up a window to Save As
$ExcelWB = new-object -comobject excel.application
$Workbook = $ExcelWB.Workbooks.Open("C:\scripts\AD\temp\10-22-2012.xlsx") 
$Workbook.SaveAs("C:\scripts\AD\temp\10-22-2012_Test.csv",6)
$ExcelWB.quit()

Open in new window

Try..
$File = "C:\user1.xlsx"
$savePath = "C:\Result.csv"
$objExcel = New-Object -ComObject Excel.Application
$objworkbook=$objExcel.Workbooks.Open($File)
$objworkbook.SaveAs($savePath,6)
$objworkbook.Close($false)
$objExcel.Quit()
Import-Csv -Path $savePath

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of namerg

ASKER

Almost Perfect, it does create the CSV but it display the contents on the xlsx or csv in the console while running the script.

Last Name               : Gilles
First Name              : Elisabeth
Dept Descrip            : 1.A6300 - AR Resolution
Social Security Numbers : XXXXXXXXX
Employment Category     : F
Job Title               : AcctsReceivableSpecialist
Work Phone              : 303303456
Room                    :
Clock Number            : 2780
Date Of Birth           : 9/9/1980
Div Descrip             : Administration

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of namerg

ASKER

Love Subsun. You da man. Thanks a lot.