How to convert xlsx file to csv file using shell script?
sudo pip install xlsx2csv
You can refer to
https://github.com/dilshod/xlsx2csv
Convert xlsx to text CSV via command line only on Linux
Here is the command:
localc --headless --convert-to csv:"Text - txt - csv (StarCalc)" *.xlsx
The above will save all converted files in current directory(directory from where you'll run the command). All converted files will have their filename extensions changed to csv.
Alternative, method is the use of unoconv
which i've not used.
Convert XLS to CSV on command line
Open Notepad, create a file called XlsToCsv.vbs and paste this in:
if WScript.Arguments.Count < 2 Then
WScript.Echo "Error! Please specify the source path and the destination. Usage: XlsToCsv SourcePath.xls Destination.csv"
Wscript.Quit
End If
Dim oExcel
Set oExcel = CreateObject("Excel.Application")
Dim oBook
Set oBook = oExcel.Workbooks.Open(Wscript.Arguments.Item(0))
oBook.SaveAs WScript.Arguments.Item(1), 6
oBook.Close False
oExcel.Quit
WScript.Echo "Done"
Then from a command line, go to the folder you saved the .vbs file in and run:
XlsToCsv.vbs [sourcexlsFile].xls [destinationcsvfile].csv
This requires Excel to be installed on the machine you are on though.
shell script to convert .xls to .csv and then delete the .xls files that are converted?
You can edit this line:
for i in /reports/cctv_xls/*.xls; do libreoffice --headless --convert-to csv "$i" --outdir /cctv_reports/cctv_csv/; done
to be
for i in /reports/cctv_xls/*.xls; do libreoffice --headless --convert-to csv "$i" --outdir /cctv_reports/cctv_csv/ && rm $i; done
this will delete the xls
file only if its successfully converted to csv
Related Topics
How to Install Gcc 4.9.2 on Rhel 7.4
What Is the Meaning of So_Reuseaddr (Setsockopt Option) - Linux
What Does the Number in Parentheses Shown After Unix Command Names in Manpages Mean
Exploring Docker Container'S File System
"Failed to Load Platform Plugin "Xcb" " While Launching Qt5 App on Linux Without Qt Installed
How to Recursively Grep All Directories and Subdirectories
Finding Which Process Was Killed by Linux Oom Killer
How to Debug the Linux Kernel With Gdb and Qemu
What Happens If There Is No Exit System Call in an Assembly Program
How to Install Latest Version of Git on Centos 8.X/7.X/6.X
How to Disassemble Raw 16-Bit X86 Machine Code
How to Start Solr Automatically
Pipe Only Stderr Through a Filter
How Can a Process Intercept Stdout and Stderr of Another Process on Linux