- How to convert xlsx files to xls or csv format on Linux
- Method One: Gnumeric
- Method Two: xlsx2csv
- Method Three: OpenOffice
- Method Four: Google Docs
- Support Xmodulo
- Конвертер XLS (EXCEL) в XLSX (EXCEL)
- Сконвертируйте ваши xls-файлы в xlsx онлайн и бесплатно
- Лист Microsoft Excel (97-2003)
- Лист Office Open XML
- Как сконвертировать XLS в XLSX
- Загрузите xls-файл(ы)
- Выберите «в xlsx»
- Загрузите ваш xlsx-файл
- xls2xlsx 0.1.5
- Navigation
- Project links
- Statistics
- Maintainers
- Classifiers
- Project description
- Features
- Installation
- Usage
- Dependencies
- Implementation Notes
- Convert xlsx to csv in Linux with command line
- 10 Answers 10
- Можно ли пересохранить xls\xlsx документ в linux, с помощью API из командной строки?
How to convert xlsx files to xls or csv format on Linux
Last updated on September 19, 2020 by Dan Nanni
The xlsx file name extension is a new file format based on XML, first used by Microsoft Office Excel 2007 spreadsheet application. The letter x appended to the existing xls extension used by earlier versions of Excel, signifies that the format is based on XML. If you would like to open or edit an xlsx file created by Excel 2007 or later, on an earlier version of Excel or any other spreadsheet application, you need to convert xlsx files first.
There are four different ways you can convert xlsx files on Linux.
Method One: Gnumeric
The first method is to use Gnumeric. Gnumeric is a free spreadsheet program which can import or export data in different file formats such as csv , xls and xlsx . Gnumeric comes with a command-line utility called ssconvert which can convert between different spreadsheet file formats. In order to convert xls files to xlsx or csv format by using Gnumeric, first install Gnumeric. Once Gnumeric is installed, you can use ssconvert .
Note that ssconvert accepts arguments in the following format.
In the above, —export-type is optional, and without —export-type , ssconvert can infer export type from the extension of output file. If you want to explicitly specify export type, ID can be one of the following.
- Gnumeric_Excel:excel_dsf : Microsoft Excel 97/2000/XP, 5.0/95 format
- Gnumeric_Excel:xlsx : Microsoft Excel 2007
- Gnumeric_pdf:pdf_assistant : Portable Document Format (PDF)
- Gnumeric_stf:stf_csv: Comma Separated Values (CSV)
So if you would like to convert xlsx files to csv format using ssconvert :
Method Two: xlsx2csv
The drawback of the Gnumeric-based method is that you need to install Gnumeric which may be too bloated software to install just for file conversion. A more lightweight way is to use xlsx2csv which is a python tool for xlsx to csv conversion.
Method Three: OpenOffice
Besides these methods, you can also use OpenOffice (if you already have it installed) to perform xlsx format conversions. OpenOffice comes with a command-line utility called unoconv which can convert xlsx files.
If you do not have it installed, you can install it with:
Note that once you install unoconv using apt-get , it will install OpenOffice package as well.
Method Four: Google Docs
The final method of converting xlsx files is to use Google Spreadsheets. Google Spreadsheets can import Excel 2007 files. Thus, all you have to do is to import your xlsx file on to Google Docs Spreadsheet, click on Download as menu, and choose an appropriate file format: Excel ( xls ), PDF, CSV, Text. Note that document files which can be uploaded to Google Docs for conversion cannot be larger than 2MB .
Support Xmodulo
This website is made possible by minimal ads and your gracious donation via PayPal (Credit Card) or Bitcoin ( 1M161JGAkz3oaHNvTiPFjNYkeABox8rb4g ).
Источник
Конвертер XLS (EXCEL) в XLSX (EXCEL)
Сконвертируйте ваши xls-файлы в xlsx онлайн и бесплатно
- Image
- Document
- Ebook
- Audio
- Archive
- Video
- Presentation
- Font
- Vector
- CAD
- abc
- abw
- csv
- dbk
- djvu
- dng
- doc
- docm
- docx
- erf
- ebm
- ewm
- emw
- gzip
- kwd
- odt
- oxps
- ppt
- pptx
- rtf
- rar
- txt
- wps
- xls
- xlsx
- zip
- Image
- Document
- Ebook
- Audio
- Archive
- Video
- Presentation
- Font
- Vector
- CAD
- abc
- abw
- csv
- dbk
- djvu
- dng
- doc
- docm
- docx
- erf
- ebm
- ewm
- emw
- gzip
- kwd
- odt
- oxps
- ppt
- pptx
- rtf
- rar
- txt
- wps
- xls
- xlsx
- zip
Лист Microsoft Excel (97-2003)
Лист Office Open XML
Как сконвертировать XLS в XLSX
Загрузите xls-файл(ы)
Выберите файлы с компьютера, Google Диска, Dropbox, по ссылке или перетащив их на страницу.
Выберите «в xlsx»
Выберите xlsx или любой другой формат, который вам нужен (более 200 поддерживаемых форматов)
Загрузите ваш xlsx-файл
Позвольте файлу сконвертироваться и вы сразу сможете скачать ваш xlsx-файл
Источник
xls2xlsx 0.1.5
pip install xls2xlsx Copy PIP instructions
Released: Nov 3, 2020
Convert xls file to xlsx
Navigation
Project links
Statistics
View statistics for this project via Libraries.io, or by using our public dataset on Google BigQuery
License: MIT License (MIT license)
Author: Joe Cool
Requires: Python >=3.6
Maintainers
Classifiers
- Development Status
- 4 — Beta
- Intended Audience
- Developers
- License
- OSI Approved :: MIT License
- Natural Language
- English
- Programming Language
- Python :: 3
- Python :: 3.6
- Python :: 3.7
- Python :: 3.8
Project description
Convert xls file to xlsx
Features
- Convert .xls files to .xlsx using xlrd and openpyxl.
- Convert .htm and .mht files containing tables or excel contents to .xlsx using beautifulsoup4 and openpyxl.
We attempt to support anything that the underlying packages used will support. For example, the following are supported for both input types:
- Multiple worksheets
- Text, Numbers, Dates/Times, Unicode
- Fonts, text color, bold, italic, underline, double underline, strikeout
- Solid and Pattern Fills with color
- Borders: Solid, Hair, Thin, Thick, Double, Dashed, Dotted; with color
- Alignment: Horizontal, Vertical, Rotated, Indent, Shrink To Fit
- Number Formats, including unicode currency symbols
- Hidden Rows and Columns
- Merged Cells
- Hyperlinks (only 1 per cell)
- Comments
These features are additionally supported by the .xls input format:
These features are additional supported by the .htm and .mht input formats:
Not supported by either format:
- Conditional Formatting (the current stylings are preserved)
- Formulas (the calculated values are preserved)
- Charts (the image of the chart is handled by .htm and .mht input formats)
- Drawings (the image of the drawing is handled by .htm and .mht input formats)
- Pivot tables (the current data is preserved)
- Text boxes (converted to an image by .htm and .mht input formats)
- Shapes and Clip Art (converted to an image by .htm and .mht input formats)
- Autofilter (the current filtered out rows are preserved)
- Rich text in cells (openpyxl doesn’t support this: only styles applied to the entire cell are preserved)
- Named Ranges
- Macros (VBA)
Installation
To install xls2xlsx, run this command in your terminal:
This is the preferred method to install xls2xlsx, as it will always install the most recent stable release.
Usage
To use xls2xlsx from the command line:
This will create file.xlsx in the current folder. file.xls can be any .xls, .htm, or .mht file and can also be a URL. The -v flag will print the input and output filename.
To use xls2xlsx in a project:
The xls2xlsx.to_xlsx method returns the filename given. If no filename is provided, the method returns the openpyxl workbook.
The input file can be in any of the following formats:
- Excel 97-2003 workbook (.xls)
- Web page (.htm, .html), optionally including a _Files folder
- Single file web page (.mht, .mhtml)
The input specified can also be any of the following:
- A filename / pathname
- A url
- A file-like object (opened in Binary mode for .xls and either Binary or Text mode otherwise)
- The contents of a .xls file as a bytes object
- The contents of a .htm or .mht file as a str object
Note: The file format is determined by examining the file contents, not by looking at the file extension.
Dependencies
Python >= 3.6 is required.
These packages are also required: xlrd, openpyxl, requests, beautifulsoup4, Pillow, python-dateutil, cssutils, webcolors, currency-symbols, fonttools, PyYAML.
Implementation Notes
The .htm and .mht input format conversion uses ImageFont from Pillow to measure the size (width and height) of cell contents. The first time you use it, it will look for font files in standard places on your system and create a Font Name to filename mapping. If the proper font files are not found on your system corresponding to the fonts used in the input file, then as a backup, an estimation algorithm is used.
If passed a .mht file (or url), the temporary folder name specified in the file will be used to unpack the contents for processing, then this folder will be removed when done.
Источник
Convert xlsx to csv in Linux with command line
I’m looking for a way to convert xlsx files to csv files on Linux.
I do not want to use PHP/Perl or anything like that since I’m looking at processing several millions of lines, so I need something quick. I found a program on the Ubuntu repos called xls2csv but it will only convert xls (Office 2003) files (which I’m currently using) but I need support for the newer Excel files.
10 Answers 10
The Gnumeric spreadsheet application comes with a command line utility called ssconvert that can convert between a variety of spreadsheet formats:
To install on Ubuntu:
To install on Mac:
You can do this with LibreOffice:
For reasons not clear to me, you might need to run this with sudo. You can make LibreOffice work with sudo without requiring a password by adding this line to you sudoers file:
If you already have a Desktop environment then I’m sure Gnumeric / LibreOffice would work well, but on a headless server (such as Amazon Web Services), they require dozens of dependencies that you also need to install.
I found this Python alternative:
Took 2 seconds to install and works like a charm.
If you have multiple sheets you can export all at once, or one at a time:
He also links to several alternatives built in Bash, Python, Ruby, and Java.
In bash, I used this libreoffice command to convert all my xlsx files in the current directory:
Close all your Libre Office open instances before executing, or it will fail silently.
The command takes care of spaces in the filename.
Tried again some years later, and it didn’t work. This thread gives some tips, but the quickest solution was to run as root (or running a sudo libreoffice ). Not elegant, but quick.
Use the command scalc.exe in Windows
For details check their excellent docs
Another option would be to use R via a small bash wrapper for convenience:
If .xlsx file has many sheets, -s flag can be used to get the sheet you want. For example:
second_sheet.csv would contain data of 2nd sheet in my_file.xlsx .
Using the Gnumeric spreadsheet application which comes which a commandline utility called ssconvert is indeed super simple:
If you are OK to run Java command line then you can do it with Apache POI HSSF’s Excel Extractor. It has a main method that says to be the command line extractor. This one seems to just dump everything out. They point out to this example that converts to CSV. You would have to compile it before you can run it but it too has a main method so you should not have to do much coding per se to make it work.
Another option that might fly but will require some work on the other end is to make your Excel files come to you as Excel XML Data or XML Spreadsheet of whatever MS calls that format these days. It will open a whole new world of opportunities for you to slice and dice it the way you want.
As others said, libreoffice can convert xls files to csv. The problem for me was the sheet selection.
This libreoffice Python script does a fine job at converting a single sheet to CSV.
The only downside (on my end) is that —headless doesn’t seem to work. I have a LO window that shows up for a second and then quits.
That’s OK with me, it’s the only tool that does the job rapidly.
Источник
Можно ли пересохранить xls\xlsx документ в linux, с помощью API из командной строки?
Имеется большое количество разных входящих exel документов из разных неконтролируемых источников. Microsoft Office и LibreOffice корректно их отображают. Но если разбирать некоторые файлы, например, Roo (https://github.com/hmcgowan/roo — гем для ruby), то некоторые файлы выпадают с ошибкой OLE2 signature. ) Как я понимаю, дело в том, что экселевские файлы могут быть сформированы очень по-разному, с разным количеством дополнений (в стиле микрософтовского экселя, комментариев и т.д.), умные офисы умеют хорошо их отображать, а низкоуровневые инструменты — не особо.
Сейчас помогает открыть такой «неправильный» файл вручную в офисе (либре или микрософте) и тут же его пересохранить в формате microsoft exel 97\2003. И тогда все работает, как нужно.
Есть ли возможность делать это пересхоранение, с помощью какого-то апи офиса ?
Знаю, что есть, например, axlsx. Возможно, аналоги OLE, но, т.к. все уже работает и осталось только это, хотелось бы обойтись малой кровью и не искать новые сюрпризы
- Вопрос задан более трёх лет назад
- 2807 просмотров
Libre Office имеет интерфейс командной строки
Пример:
libreoffice -headless -convert-to xls ./*.xlsx
libreoffice —headless -convert-to xls ./file.xlsx -outdir
Используем у нас, но не работает если в трее висит иконка, либо если офис уже запущен
Источник