Convert xlsx to csv in linux command line

calendar_today Asked May 11, 2012
thumb_up 96 upvotes
history Updated April 14, 2026

Direct Answer

The Gnumeric spreadsheet application comes with a commandline utility called ssconvert that can convert between a variety of spreadsheet formats on the commandline: $ ssconvert…. This is a 10-line Excel VBA snippet, ranked #2nd of 303 by community upvote score, from 2012.


The Problem (Q-score 108, ranked #2nd of 303 in the Excel VBA archive)

The scenario as originally posted in 2012

I’m looking for a way to convert xlsx files to csv files in 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 repo’s called xls2csv but it will only convert xls(Office 2003) files(which i’m currently using) but, i need to add support for the newer excel files, any ideas?

Why community consensus is tight on this one

Across 303 Excel VBA entries in the archive, the accepted answer here holds elite answer (top 10 %%) status — meaning voters are unusually aligned on the right fix.


The Verified Solution — elite answer (top 10 %%) (+96)

10-line Excel VBA pattern (copy-ready)

The Gnumeric spreadsheet application comes with a commandline utility called ssconvert that can convert between a variety of spreadsheet formats on the commandline:

$ ssconvert Book1.xlsx newfile.csv
Using exporter Gnumeric_stf:stf_csv

$ cat newfile.csv 
Foo,Bar,Baz
1,2,3
123.6,7.89,
2012/05/14,,
The,last,Line

To install on Ubuntu:

apt-get install gnumeric


When to Use It — vintage (14+ years old, pre-2013)

A top-10 Excel VBA pattern — why it still holds up

Ranks #2nd of 303 in the Excel VBA archive. The only pattern ranked immediately above it is “Shortcut to Apply a Formula to an Entire Column in Excel” — compare both if you’re choosing between approaches.

What changed between 2012 and 2026

The answer is 14 years old. The Excel VBA object model has been stable across Office 2013, 2016, 2019, 2021, 365, and 2024/2026 LTSC, so the pattern still compiles. Changes that might affect you: 64-bit API declarations (use PtrSafe), blocked macros in downloaded files (Mark-of-the-Web), and the shift toward Office Scripts for web-first workflows.

help
Frequently Asked Questions

Why is this answer the top decile of Excel VBA Q&A?
expand_more

Answer score +96 vs the Excel VBA archive median ~32; this entry is elite. The score plus 108 supporting upvotes on the question itself (+108) means the asker and 95 subsequent voters all validated the approach.

Does the 10-line snippet run as-is in Office 2026?
expand_more

Yes. The 10-line pattern compiles on Office 365, Office 2024, and Office LTSC 2026. Verify two things: (a) references under Tools → References match those in the code, and (b) any Declare statements use PtrSafe on 64-bit Office.

This answer is 14 years old. Is it still relevant in 2026?
expand_more

Published 2012, which is 14 year(s) before today’s Office 2026 build. The Excel VBA object model has had no breaking changes in that window. Three things to re-test: (1) blocked macros on downloaded files (Mark-of-the-Web), (2) 64-bit API declarations (PtrSafe, LongPtr), (3) any shift toward Office Scripts for web scenarios.

Which Excel VBA pattern ranks just above this one at #1?
expand_more

The pattern one rank above is “Shortcut to Apply a Formula to an Entire Column in Excel”. If your use case overlaps, compare both before committing.

Data source: Community-verified Q&A snapshot. Q-score 108, Answer-score 96, original post 2012, ranked #2nd of 303 in the Excel VBA archive. Last regenerated April 14, 2026.