is it possible to convert txt to xlsx in command line?
Hi there,
Since you guys really helped me with my last issue: I have this 300+ txt files (containing character-delimited data) that i would like to convert to xlsx. The manual way would include opening the file with LibraOffice, and save it as xlsx. However, i feel there must be a batch mode?! It is incredibly tedious) A really nice addon would be the manipulation of the data (what i do: - text to columns, using "semicolon" and "tab" as delimiter - Insert column in A, add numbers 1-n to each line (to preserve original data structure if needed). But anything that save me some clicks is very welcome. Thank you so much! /edit: cp/mv *.txt *.xlsx did it. Very simple :( I need to think about a for loop then. Sorry for bothering. However, if you have ideas about the other two things (but i would need R for the column adding, i guess). |
|
Convert CSV to XLSX:
Code:
soffice --headless --convert-to xlsx:"Calc MS Excel 2007 XML" somefile.csv edit: This should get you started on the rest. Code:
for file in *.txt; do |
[QUOTE=pwc101;5029969]Convert CSV to XLSX:
Code:
soffice --headless --convert-to xlsx:"Calc MS Excel 2007 XML" somefile.csv This is great. I wish I had know about this before. Thanks for this. |
Dear pwc101,
many thanks for your help. However, two issues occured: 1. The single line soffice --headless --convert-to xlsx:"Calc MS Excel 2007 XML" somefile.csv is accepted (i.e. there is no error message), but fails to do anything. No file is produced. 2. I tried to run your script (MANY thanks for your effort, btw) in an executable, but i get: "ConvertXLSX.sh: Syntax error: "(" unexpected" What do i do wrong? Thank you! |
All times are GMT -5. The time now is 06:52 AM. |