Convert .xls/.xlsx spreadsheets to multiple .csv's based on a listHow to split an ODS spreadsheet file into...
What typically incentivizes a professor to change jobs to a lower ranking university?
How much RAM could one put in a typical 80386 setup?
A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?
Why are electrically insulating heatsinks so rare? Is it just cost?
Why can't I see bouncing of a switch on an oscilloscope?
Example of a continuous function that don't have a continuous extension
Do I have a twin with permutated remainders?
Why don't electron-positron collisions release infinite energy?
How old can references or sources in a thesis be?
How to test if a transaction is standard without spending real money?
How to say job offer in Mandarin/Cantonese?
Email Account under attack (really) - anything I can do?
Is it unprofessional to ask if a job posting on GlassDoor is real?
What is the word for reserving something for yourself before others do?
Have astronauts in space suits ever taken selfies? If so, how?
Why dont electromagnetic waves interact with each other?
Is this a crack on the carbon frame?
Why was the small council so happy for Tyrion to become the Master of Coin?
What does it mean to describe someone as a butt steak?
Why Is Death Allowed In the Matrix?
The Two and the One
How can bays and straits be determined in a procedurally generated map?
Approximately how much travel time was saved by the opening of the Suez Canal in 1869?
LaTeX closing $ signs makes cursor jump
Convert .xls/.xlsx spreadsheets to multiple .csv's based on a list
How to split an ODS spreadsheet file into csv files per sheet on the terminal?How do you convert many files from .xlsx to .xls?How to script Subversion verification?Sort file into directories base on their extensionconvert txt file to csv seperated with tabsIs there a way, ideally using the command line, to convert multiple .csv files to one multi-sheet .xls spreadsheet?How does one properly copy a file into multiple folders and subfolders without overwriting the file contents in the destination folders?xls/xlsx extentions not associated properly (considered as archives)Convert mp4 to mp3 Using Shell ScriptWriting out only files existing in one directory or other or having different size or time of last modifyBackup script for mysql
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I need to convert all sheets of a single .xls/.xlsx file to a .csv. This will be done on all .xls files in all directories and sub-directories (recursively).
Step 1: Get the sheetnames of all .xls into a .csv using:
for file in $(find . -name '*.xls' -o -name '*.xlsx');do in2csv -n "$file" > ${file%.xls}-sheetnames-list.csv; done
filename-sheetnames-list.csv
can act as a list:
sheetname1
sheetname2
sheetname3
Step 2 :
The code for converting a specific sheet into a .csv using in2csv is:
in2csv --sheet "SHEETNAME" filename.xls > filename-SHEETNAME.csv
How can I get every sheetname in a .xls/x and write every sheet separately for all directories containing a .xls/x ?
in2csv --write-sheets "-" filename.xls > filename-sheet1.csv filename-sheet2.csv ....
gives output only on sheet1.csv, not sure how to get all sheets from this.
command-line csv xls
add a comment |
I need to convert all sheets of a single .xls/.xlsx file to a .csv. This will be done on all .xls files in all directories and sub-directories (recursively).
Step 1: Get the sheetnames of all .xls into a .csv using:
for file in $(find . -name '*.xls' -o -name '*.xlsx');do in2csv -n "$file" > ${file%.xls}-sheetnames-list.csv; done
filename-sheetnames-list.csv
can act as a list:
sheetname1
sheetname2
sheetname3
Step 2 :
The code for converting a specific sheet into a .csv using in2csv is:
in2csv --sheet "SHEETNAME" filename.xls > filename-SHEETNAME.csv
How can I get every sheetname in a .xls/x and write every sheet separately for all directories containing a .xls/x ?
in2csv --write-sheets "-" filename.xls > filename-sheet1.csv filename-sheet2.csv ....
gives output only on sheet1.csv, not sure how to get all sheets from this.
command-line csv xls
2
Why not justfind
every.xls{,x}
and loop over every sheet using-exec
?
– dessert
Nov 6 '17 at 14:23
1
@glennjackman this is perfectly on topic here, just as it would be on Unix & Linux.
– terdon♦
Nov 6 '17 at 16:07
add a comment |
I need to convert all sheets of a single .xls/.xlsx file to a .csv. This will be done on all .xls files in all directories and sub-directories (recursively).
Step 1: Get the sheetnames of all .xls into a .csv using:
for file in $(find . -name '*.xls' -o -name '*.xlsx');do in2csv -n "$file" > ${file%.xls}-sheetnames-list.csv; done
filename-sheetnames-list.csv
can act as a list:
sheetname1
sheetname2
sheetname3
Step 2 :
The code for converting a specific sheet into a .csv using in2csv is:
in2csv --sheet "SHEETNAME" filename.xls > filename-SHEETNAME.csv
How can I get every sheetname in a .xls/x and write every sheet separately for all directories containing a .xls/x ?
in2csv --write-sheets "-" filename.xls > filename-sheet1.csv filename-sheet2.csv ....
gives output only on sheet1.csv, not sure how to get all sheets from this.
command-line csv xls
I need to convert all sheets of a single .xls/.xlsx file to a .csv. This will be done on all .xls files in all directories and sub-directories (recursively).
Step 1: Get the sheetnames of all .xls into a .csv using:
for file in $(find . -name '*.xls' -o -name '*.xlsx');do in2csv -n "$file" > ${file%.xls}-sheetnames-list.csv; done
filename-sheetnames-list.csv
can act as a list:
sheetname1
sheetname2
sheetname3
Step 2 :
The code for converting a specific sheet into a .csv using in2csv is:
in2csv --sheet "SHEETNAME" filename.xls > filename-SHEETNAME.csv
How can I get every sheetname in a .xls/x and write every sheet separately for all directories containing a .xls/x ?
in2csv --write-sheets "-" filename.xls > filename-sheet1.csv filename-sheet2.csv ....
gives output only on sheet1.csv, not sure how to get all sheets from this.
command-line csv xls
command-line csv xls
edited Nov 8 '17 at 13:30
csheth
asked Nov 6 '17 at 14:08
cshethcsheth
15612
15612
2
Why not justfind
every.xls{,x}
and loop over every sheet using-exec
?
– dessert
Nov 6 '17 at 14:23
1
@glennjackman this is perfectly on topic here, just as it would be on Unix & Linux.
– terdon♦
Nov 6 '17 at 16:07
add a comment |
2
Why not justfind
every.xls{,x}
and loop over every sheet using-exec
?
– dessert
Nov 6 '17 at 14:23
1
@glennjackman this is perfectly on topic here, just as it would be on Unix & Linux.
– terdon♦
Nov 6 '17 at 16:07
2
2
Why not just
find
every .xls{,x}
and loop over every sheet using -exec
?– dessert
Nov 6 '17 at 14:23
Why not just
find
every .xls{,x}
and loop over every sheet using -exec
?– dessert
Nov 6 '17 at 14:23
1
1
@glennjackman this is perfectly on topic here, just as it would be on Unix & Linux.
– terdon♦
Nov 6 '17 at 16:07
@glennjackman this is perfectly on topic here, just as it would be on Unix & Linux.
– terdon♦
Nov 6 '17 at 16:07
add a comment |
4 Answers
4
active
oldest
votes
You can just put a loop inside another loop.
To avoid errors, don't use for
with find
results.
while IFS= read -r file; do
while IFS= read -r sheet; do
in2csv --sheet "$sheet" "$file" > "${file%.*}-${sheet}.csv"
done < <(in2csv -n "$file")
done < <(find . -name '*.xls' -o -name '*.xlsx')
@muru ah crap. You're absolutely right. I'd tested in an environment where the IFS had already been changed so of course it propagated downwards. Idiot. Thanks, edit reverted.
– terdon♦
Nov 7 '17 at 9:01
@RoVo the first option works fine. The second one however gives me no output or error. I am unsure why; for a single.xls
in2csv --write-sheets "-" filename.xls > sheetname.csv
gives only the first sheet. I don't know what additional info to add to write all sheets. That shall give us clues to correct your code.
– csheth
Nov 8 '17 at 7:37
did you update to that version 1.0.2 ?pip install csvkit -U
. I think the way it works is not what you like, with the simple skript from 1st option you have more ways to control the output and the filenames etc.
– RoVo
Nov 8 '17 at 8:02
still doesn't work with the update, and yes I'd prefer using a list than--write-sheets
Maybe you can set this alternative option as another answer... I will accept the first option as the answer then. Thanks @RoVo
– csheth
Nov 8 '17 at 8:24
1
Maybe generally a good idea to have alternative options in another answer. Thanks, glad that I could help.
– RoVo
Nov 8 '17 at 8:55
add a comment |
Skipping find and using bash:
shopt -s globstar # enable recursive globbing
for f in **/*.xls{,x} # for files ending in .xls or .xlsx
do
in2csv -n "$f" | # get the sheetnames
xargs -I {} bash -c 'in2csv --sheet "$2" "$1" > "${1%.*}"-"$2".csv' _ "$f" {} # {} will be replaced with the sheetname
done
this script looks elegant but its output isfilename-{}.csv
containing no data. I'm a novice and can't seem to find the error by editing the script and reading up. Some help?
– csheth
Nov 8 '17 at 7:23
@ChintanSheth my bad, I'd forgotten the redirection would be outsidexargs
. Corrected, not as elegant now.
– muru
Nov 8 '17 at 8:01
xargs
and>
is evil :-P. That's why I prefer another loop, it's less error prone.
– RoVo
Nov 8 '17 at 8:01
@RoVo I'd have usually gone for another loop too, just wanted to show another method here.
– muru
Nov 8 '17 at 8:03
This works now, however slightly slower than @RoVo answer.
– csheth
Nov 8 '17 at 8:25
add a comment |
csvkit version > 1.0.2 has a builtin function to write all sheets:
--write-sheets: WRITE_SHEETS
The names of the Excel sheets to write to files, or
"-" to write all sheets.
So you could try the following:
find . -name '*.xls' -o -name '*.xlsx' -exec in2csv --write-sheets "-" {} ;
Note:
This seems not to work 100% as expected. But worth a try and as this is the first version with that option maybe in future versions the implementation is better/easier.
add a comment |
Use Gnumeric
:
ssconvert -S filename.xlsx filename.csv
to get one csv
file per sheet.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f973534%2fconvert-xls-xlsx-spreadsheets-to-multiple-csvs-based-on-a-list%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can just put a loop inside another loop.
To avoid errors, don't use for
with find
results.
while IFS= read -r file; do
while IFS= read -r sheet; do
in2csv --sheet "$sheet" "$file" > "${file%.*}-${sheet}.csv"
done < <(in2csv -n "$file")
done < <(find . -name '*.xls' -o -name '*.xlsx')
@muru ah crap. You're absolutely right. I'd tested in an environment where the IFS had already been changed so of course it propagated downwards. Idiot. Thanks, edit reverted.
– terdon♦
Nov 7 '17 at 9:01
@RoVo the first option works fine. The second one however gives me no output or error. I am unsure why; for a single.xls
in2csv --write-sheets "-" filename.xls > sheetname.csv
gives only the first sheet. I don't know what additional info to add to write all sheets. That shall give us clues to correct your code.
– csheth
Nov 8 '17 at 7:37
did you update to that version 1.0.2 ?pip install csvkit -U
. I think the way it works is not what you like, with the simple skript from 1st option you have more ways to control the output and the filenames etc.
– RoVo
Nov 8 '17 at 8:02
still doesn't work with the update, and yes I'd prefer using a list than--write-sheets
Maybe you can set this alternative option as another answer... I will accept the first option as the answer then. Thanks @RoVo
– csheth
Nov 8 '17 at 8:24
1
Maybe generally a good idea to have alternative options in another answer. Thanks, glad that I could help.
– RoVo
Nov 8 '17 at 8:55
add a comment |
You can just put a loop inside another loop.
To avoid errors, don't use for
with find
results.
while IFS= read -r file; do
while IFS= read -r sheet; do
in2csv --sheet "$sheet" "$file" > "${file%.*}-${sheet}.csv"
done < <(in2csv -n "$file")
done < <(find . -name '*.xls' -o -name '*.xlsx')
@muru ah crap. You're absolutely right. I'd tested in an environment where the IFS had already been changed so of course it propagated downwards. Idiot. Thanks, edit reverted.
– terdon♦
Nov 7 '17 at 9:01
@RoVo the first option works fine. The second one however gives me no output or error. I am unsure why; for a single.xls
in2csv --write-sheets "-" filename.xls > sheetname.csv
gives only the first sheet. I don't know what additional info to add to write all sheets. That shall give us clues to correct your code.
– csheth
Nov 8 '17 at 7:37
did you update to that version 1.0.2 ?pip install csvkit -U
. I think the way it works is not what you like, with the simple skript from 1st option you have more ways to control the output and the filenames etc.
– RoVo
Nov 8 '17 at 8:02
still doesn't work with the update, and yes I'd prefer using a list than--write-sheets
Maybe you can set this alternative option as another answer... I will accept the first option as the answer then. Thanks @RoVo
– csheth
Nov 8 '17 at 8:24
1
Maybe generally a good idea to have alternative options in another answer. Thanks, glad that I could help.
– RoVo
Nov 8 '17 at 8:55
add a comment |
You can just put a loop inside another loop.
To avoid errors, don't use for
with find
results.
while IFS= read -r file; do
while IFS= read -r sheet; do
in2csv --sheet "$sheet" "$file" > "${file%.*}-${sheet}.csv"
done < <(in2csv -n "$file")
done < <(find . -name '*.xls' -o -name '*.xlsx')
You can just put a loop inside another loop.
To avoid errors, don't use for
with find
results.
while IFS= read -r file; do
while IFS= read -r sheet; do
in2csv --sheet "$sheet" "$file" > "${file%.*}-${sheet}.csv"
done < <(in2csv -n "$file")
done < <(find . -name '*.xls' -o -name '*.xlsx')
edited Nov 26 '17 at 21:51
Eliah Kagan
83.2k22229369
83.2k22229369
answered Nov 6 '17 at 14:26
RoVoRoVo
8,1511943
8,1511943
@muru ah crap. You're absolutely right. I'd tested in an environment where the IFS had already been changed so of course it propagated downwards. Idiot. Thanks, edit reverted.
– terdon♦
Nov 7 '17 at 9:01
@RoVo the first option works fine. The second one however gives me no output or error. I am unsure why; for a single.xls
in2csv --write-sheets "-" filename.xls > sheetname.csv
gives only the first sheet. I don't know what additional info to add to write all sheets. That shall give us clues to correct your code.
– csheth
Nov 8 '17 at 7:37
did you update to that version 1.0.2 ?pip install csvkit -U
. I think the way it works is not what you like, with the simple skript from 1st option you have more ways to control the output and the filenames etc.
– RoVo
Nov 8 '17 at 8:02
still doesn't work with the update, and yes I'd prefer using a list than--write-sheets
Maybe you can set this alternative option as another answer... I will accept the first option as the answer then. Thanks @RoVo
– csheth
Nov 8 '17 at 8:24
1
Maybe generally a good idea to have alternative options in another answer. Thanks, glad that I could help.
– RoVo
Nov 8 '17 at 8:55
add a comment |
@muru ah crap. You're absolutely right. I'd tested in an environment where the IFS had already been changed so of course it propagated downwards. Idiot. Thanks, edit reverted.
– terdon♦
Nov 7 '17 at 9:01
@RoVo the first option works fine. The second one however gives me no output or error. I am unsure why; for a single.xls
in2csv --write-sheets "-" filename.xls > sheetname.csv
gives only the first sheet. I don't know what additional info to add to write all sheets. That shall give us clues to correct your code.
– csheth
Nov 8 '17 at 7:37
did you update to that version 1.0.2 ?pip install csvkit -U
. I think the way it works is not what you like, with the simple skript from 1st option you have more ways to control the output and the filenames etc.
– RoVo
Nov 8 '17 at 8:02
still doesn't work with the update, and yes I'd prefer using a list than--write-sheets
Maybe you can set this alternative option as another answer... I will accept the first option as the answer then. Thanks @RoVo
– csheth
Nov 8 '17 at 8:24
1
Maybe generally a good idea to have alternative options in another answer. Thanks, glad that I could help.
– RoVo
Nov 8 '17 at 8:55
@muru ah crap. You're absolutely right. I'd tested in an environment where the IFS had already been changed so of course it propagated downwards. Idiot. Thanks, edit reverted.
– terdon♦
Nov 7 '17 at 9:01
@muru ah crap. You're absolutely right. I'd tested in an environment where the IFS had already been changed so of course it propagated downwards. Idiot. Thanks, edit reverted.
– terdon♦
Nov 7 '17 at 9:01
@RoVo the first option works fine. The second one however gives me no output or error. I am unsure why; for a single
.xls
in2csv --write-sheets "-" filename.xls > sheetname.csv
gives only the first sheet. I don't know what additional info to add to write all sheets. That shall give us clues to correct your code.– csheth
Nov 8 '17 at 7:37
@RoVo the first option works fine. The second one however gives me no output or error. I am unsure why; for a single
.xls
in2csv --write-sheets "-" filename.xls > sheetname.csv
gives only the first sheet. I don't know what additional info to add to write all sheets. That shall give us clues to correct your code.– csheth
Nov 8 '17 at 7:37
did you update to that version 1.0.2 ?
pip install csvkit -U
. I think the way it works is not what you like, with the simple skript from 1st option you have more ways to control the output and the filenames etc.– RoVo
Nov 8 '17 at 8:02
did you update to that version 1.0.2 ?
pip install csvkit -U
. I think the way it works is not what you like, with the simple skript from 1st option you have more ways to control the output and the filenames etc.– RoVo
Nov 8 '17 at 8:02
still doesn't work with the update, and yes I'd prefer using a list than
--write-sheets
Maybe you can set this alternative option as another answer... I will accept the first option as the answer then. Thanks @RoVo– csheth
Nov 8 '17 at 8:24
still doesn't work with the update, and yes I'd prefer using a list than
--write-sheets
Maybe you can set this alternative option as another answer... I will accept the first option as the answer then. Thanks @RoVo– csheth
Nov 8 '17 at 8:24
1
1
Maybe generally a good idea to have alternative options in another answer. Thanks, glad that I could help.
– RoVo
Nov 8 '17 at 8:55
Maybe generally a good idea to have alternative options in another answer. Thanks, glad that I could help.
– RoVo
Nov 8 '17 at 8:55
add a comment |
Skipping find and using bash:
shopt -s globstar # enable recursive globbing
for f in **/*.xls{,x} # for files ending in .xls or .xlsx
do
in2csv -n "$f" | # get the sheetnames
xargs -I {} bash -c 'in2csv --sheet "$2" "$1" > "${1%.*}"-"$2".csv' _ "$f" {} # {} will be replaced with the sheetname
done
this script looks elegant but its output isfilename-{}.csv
containing no data. I'm a novice and can't seem to find the error by editing the script and reading up. Some help?
– csheth
Nov 8 '17 at 7:23
@ChintanSheth my bad, I'd forgotten the redirection would be outsidexargs
. Corrected, not as elegant now.
– muru
Nov 8 '17 at 8:01
xargs
and>
is evil :-P. That's why I prefer another loop, it's less error prone.
– RoVo
Nov 8 '17 at 8:01
@RoVo I'd have usually gone for another loop too, just wanted to show another method here.
– muru
Nov 8 '17 at 8:03
This works now, however slightly slower than @RoVo answer.
– csheth
Nov 8 '17 at 8:25
add a comment |
Skipping find and using bash:
shopt -s globstar # enable recursive globbing
for f in **/*.xls{,x} # for files ending in .xls or .xlsx
do
in2csv -n "$f" | # get the sheetnames
xargs -I {} bash -c 'in2csv --sheet "$2" "$1" > "${1%.*}"-"$2".csv' _ "$f" {} # {} will be replaced with the sheetname
done
this script looks elegant but its output isfilename-{}.csv
containing no data. I'm a novice and can't seem to find the error by editing the script and reading up. Some help?
– csheth
Nov 8 '17 at 7:23
@ChintanSheth my bad, I'd forgotten the redirection would be outsidexargs
. Corrected, not as elegant now.
– muru
Nov 8 '17 at 8:01
xargs
and>
is evil :-P. That's why I prefer another loop, it's less error prone.
– RoVo
Nov 8 '17 at 8:01
@RoVo I'd have usually gone for another loop too, just wanted to show another method here.
– muru
Nov 8 '17 at 8:03
This works now, however slightly slower than @RoVo answer.
– csheth
Nov 8 '17 at 8:25
add a comment |
Skipping find and using bash:
shopt -s globstar # enable recursive globbing
for f in **/*.xls{,x} # for files ending in .xls or .xlsx
do
in2csv -n "$f" | # get the sheetnames
xargs -I {} bash -c 'in2csv --sheet "$2" "$1" > "${1%.*}"-"$2".csv' _ "$f" {} # {} will be replaced with the sheetname
done
Skipping find and using bash:
shopt -s globstar # enable recursive globbing
for f in **/*.xls{,x} # for files ending in .xls or .xlsx
do
in2csv -n "$f" | # get the sheetnames
xargs -I {} bash -c 'in2csv --sheet "$2" "$1" > "${1%.*}"-"$2".csv' _ "$f" {} # {} will be replaced with the sheetname
done
edited Nov 8 '17 at 8:02
answered Nov 6 '17 at 14:50
murumuru
1
1
this script looks elegant but its output isfilename-{}.csv
containing no data. I'm a novice and can't seem to find the error by editing the script and reading up. Some help?
– csheth
Nov 8 '17 at 7:23
@ChintanSheth my bad, I'd forgotten the redirection would be outsidexargs
. Corrected, not as elegant now.
– muru
Nov 8 '17 at 8:01
xargs
and>
is evil :-P. That's why I prefer another loop, it's less error prone.
– RoVo
Nov 8 '17 at 8:01
@RoVo I'd have usually gone for another loop too, just wanted to show another method here.
– muru
Nov 8 '17 at 8:03
This works now, however slightly slower than @RoVo answer.
– csheth
Nov 8 '17 at 8:25
add a comment |
this script looks elegant but its output isfilename-{}.csv
containing no data. I'm a novice and can't seem to find the error by editing the script and reading up. Some help?
– csheth
Nov 8 '17 at 7:23
@ChintanSheth my bad, I'd forgotten the redirection would be outsidexargs
. Corrected, not as elegant now.
– muru
Nov 8 '17 at 8:01
xargs
and>
is evil :-P. That's why I prefer another loop, it's less error prone.
– RoVo
Nov 8 '17 at 8:01
@RoVo I'd have usually gone for another loop too, just wanted to show another method here.
– muru
Nov 8 '17 at 8:03
This works now, however slightly slower than @RoVo answer.
– csheth
Nov 8 '17 at 8:25
this script looks elegant but its output is
filename-{}.csv
containing no data. I'm a novice and can't seem to find the error by editing the script and reading up. Some help?– csheth
Nov 8 '17 at 7:23
this script looks elegant but its output is
filename-{}.csv
containing no data. I'm a novice and can't seem to find the error by editing the script and reading up. Some help?– csheth
Nov 8 '17 at 7:23
@ChintanSheth my bad, I'd forgotten the redirection would be outside
xargs
. Corrected, not as elegant now.– muru
Nov 8 '17 at 8:01
@ChintanSheth my bad, I'd forgotten the redirection would be outside
xargs
. Corrected, not as elegant now.– muru
Nov 8 '17 at 8:01
xargs
and >
is evil :-P. That's why I prefer another loop, it's less error prone.– RoVo
Nov 8 '17 at 8:01
xargs
and >
is evil :-P. That's why I prefer another loop, it's less error prone.– RoVo
Nov 8 '17 at 8:01
@RoVo I'd have usually gone for another loop too, just wanted to show another method here.
– muru
Nov 8 '17 at 8:03
@RoVo I'd have usually gone for another loop too, just wanted to show another method here.
– muru
Nov 8 '17 at 8:03
This works now, however slightly slower than @RoVo answer.
– csheth
Nov 8 '17 at 8:25
This works now, however slightly slower than @RoVo answer.
– csheth
Nov 8 '17 at 8:25
add a comment |
csvkit version > 1.0.2 has a builtin function to write all sheets:
--write-sheets: WRITE_SHEETS
The names of the Excel sheets to write to files, or
"-" to write all sheets.
So you could try the following:
find . -name '*.xls' -o -name '*.xlsx' -exec in2csv --write-sheets "-" {} ;
Note:
This seems not to work 100% as expected. But worth a try and as this is the first version with that option maybe in future versions the implementation is better/easier.
add a comment |
csvkit version > 1.0.2 has a builtin function to write all sheets:
--write-sheets: WRITE_SHEETS
The names of the Excel sheets to write to files, or
"-" to write all sheets.
So you could try the following:
find . -name '*.xls' -o -name '*.xlsx' -exec in2csv --write-sheets "-" {} ;
Note:
This seems not to work 100% as expected. But worth a try and as this is the first version with that option maybe in future versions the implementation is better/easier.
add a comment |
csvkit version > 1.0.2 has a builtin function to write all sheets:
--write-sheets: WRITE_SHEETS
The names of the Excel sheets to write to files, or
"-" to write all sheets.
So you could try the following:
find . -name '*.xls' -o -name '*.xlsx' -exec in2csv --write-sheets "-" {} ;
Note:
This seems not to work 100% as expected. But worth a try and as this is the first version with that option maybe in future versions the implementation is better/easier.
csvkit version > 1.0.2 has a builtin function to write all sheets:
--write-sheets: WRITE_SHEETS
The names of the Excel sheets to write to files, or
"-" to write all sheets.
So you could try the following:
find . -name '*.xls' -o -name '*.xlsx' -exec in2csv --write-sheets "-" {} ;
Note:
This seems not to work 100% as expected. But worth a try and as this is the first version with that option maybe in future versions the implementation is better/easier.
answered Nov 8 '17 at 8:54
RoVoRoVo
8,1511943
8,1511943
add a comment |
add a comment |
Use Gnumeric
:
ssconvert -S filename.xlsx filename.csv
to get one csv
file per sheet.
add a comment |
Use Gnumeric
:
ssconvert -S filename.xlsx filename.csv
to get one csv
file per sheet.
add a comment |
Use Gnumeric
:
ssconvert -S filename.xlsx filename.csv
to get one csv
file per sheet.
Use Gnumeric
:
ssconvert -S filename.xlsx filename.csv
to get one csv
file per sheet.
answered 23 mins ago
James HirschornJames Hirschorn
1065
1065
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f973534%2fconvert-xls-xlsx-spreadsheets-to-multiple-csvs-based-on-a-list%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Why not just
find
every.xls{,x}
and loop over every sheet using-exec
?– dessert
Nov 6 '17 at 14:23
1
@glennjackman this is perfectly on topic here, just as it would be on Unix & Linux.
– terdon♦
Nov 6 '17 at 16:07