Link to home
Create AccountLog in
Powershell

Powershell

--

Questions

--

Followers

Top Experts

Avatar of Alfa Romeo
Alfa Romeo🇺🇸

How to convert and xlsx spreadsheet into CSV ?
Hello,

How can I convert and xlsx spreadsheet into CSV ?

Thanks,

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of BillBondoBillBondo🇺🇸

Do a file save as other formats and choose csv.

Avatar of Alfa RomeoAlfa Romeo🇺🇸

ASKER

jajajaj....buuu in Powershell ?

Avatar of SubSunSubSun🇮🇳


Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of David CarrDavid Carr🇺🇸

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 Alfa RomeoAlfa Romeo🇺🇸

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


Avatar of SubSunSubSun🇮🇳

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


Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of SubSunSubSun🇮🇳

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of Alfa RomeoAlfa Romeo🇺🇸

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
Avatar of SubSunSubSun🇮🇳

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.

Avatar of Alfa RomeoAlfa Romeo🇺🇸

ASKER

Love Subsun. You da man. Thanks a lot.
Powershell

Powershell

--

Questions

--

Followers

Top Experts

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.