[PYTHON] Convert XLSX to CSV on the command line

If you have Excel, you can save it in CSV format normally by selecting CSV format in "Save As", but there are restrictions on output such as not being able to set quotes. So how do you meet the conditions that you want to convert and customize on the command line? Use xlsx2csv.

https://github.com/dilshod/xlsx2csv

You can use it by inserting python and executing xlsx2csv.py as described in the README, but the output is basically without quotes. What should i do?

Line 114 is hardcoded with * csv.QUOTE_MINIMAL *.

    writer = csv.writer(outfile, quoting=csv.QUOTE_MINIMAL, delimiter=delimiter)

If you change this to * csv.QUOTE_ALL *, all fields will be output with quotes. The explanation of other options will be thrown in Description of csv module.

    writer = csv.writer(outfile, quoting=csv.QUOTE_ALL, delimiter=delimiter)

I searched for a similar article, but I didn't, so I wrote it down.

Recommended Posts

Convert XLSX to CSV on the command line
Batch convert all xlsx files in the folder to CSV files
Keep getting RSS on the command line
You search commandlinefu on the command line
Quickly display the QR code on the command line
Arduino development on the command line: vim + platformio
Syntax highlighting on the command line using Pygments
Operate Route53 on the command line using AWS-CLI.
Save the search results on Twitter to CSV.
Think about the selective interface on the command line
How to create an article from the command line
(Remember quickly) How to use the LINUX command line
I tried to notify the honeypot report on LINE
Convert SDF to CSV quickly
How to pass arguments when invoking python script from blender on the command line
Steps to use the AWS command line interface (Python / awscli) on Mac OS X
Search for large files on Linux from the command line
Use pyOCR to convert the description on the card into text
In the python command python points to python3.8
[linux] kill command to kill the process
Convert pdf to Text on the command line. No knowledge of Python required. About pdf2txt.py attached to pdfminer and adjustment parameters.
[Django] Command to output QuerySet to csv
[EC2] How to install and download chromedriver from the command line
A command to easily check the speed of the network on the console
GSI_DEM to geotiff conversion → UTM conversion → ascii conversion only on Ubuntu command line
Python standard module that can be used on the command line
Create a command line tool to convert dollars to yen using Python
[Python] I tried to make a simple program that works on the command line using argparse.
[Python] How to convert db file to csv
I tried to summarize the umask command
Steps to get KeePassX key on OS X with one command line
How to convert csv to tsv in CLI
[Python] Convert csv file delimiters to tab delimiters
Convert from PDF to CSV with pdfplumber
Get, test, and submit test cases on the command line in the AtCoder contest
Convert (compress) formatted JSON string to 1-line JSON
How to use the Linux grep command
How to put a line number at the beginning of a CSV file
Convert the spreadsheet to CSV and upload it to Cloud Storage with Cloud Functions
Shell command to visualize line feed code
Look up your Mac's Wi-Fi network name (SSID) on the command line
3 best ways to use the less command
Various ways to read the last line of a csv file in Python
Convert PDF of Chiba Prefecture Go To EAT member store list to CSV (command)
I stumbled on the character code when converting CSV to JSON in Python
Draw a line / scatter plot on the CSV file (2 columns) with python matplotlib
Correspondence memo when the direction key cannot be used on the python command line
I want to be notified when the command operation is completed on linux!
[Python] How to test command line parser click
How to receive command line arguments in Python
[Python] Convert from DICOM to PNG or CSV
Frequently used (personally) notes on the tar command
Convert UTF-8 CSV files to read in Excel
The story of misreading the swap line of the top command
My thoughts on python2.6 command line app template
How to measure line speed from the terminal
Try to create a new command on linux
[Introduction to Udemy Python3 + Application] 67. Command line arguments
Create a command to get the work log
Convert to HSV
Command to check the total number of CPU physical cores / logical cores / physical memory on Mac