I have a text file with 2 columns and 28 lines that I want to convert to the Ms Excel file format without opening Excel.
When I open an example Excel file with a ZIP tool, I see the following folder structure:
The files relevant here are sheet1.xml, that contains the cell addresses, and sharedStrings.xml that contains the data.
What I am looking for is a generic way to convert text files with always 2 columns and n lines to an Excel file.
excel-example.xlsx.zip (18.7 KB)
aligned.txt.zip (4.5 KB)
aligned.xlsx.zip (11.0 KB)
Doesn't Excel open tab delimited files directly ?
That's very likely. But I don't want Excel to be launched.
My first attempt to remove 5 lines from sharedStrings.xml and adjust sheet1.xml has failed. Perhaps I made an error, perhaps there are other files that need a change. Will try to figure it out.
I don't think you're going to get there by hacking the file contents in that way. Try
ssconvert (I think that's part of Homebrew's
gnumeric package), Python and
XlsxWriter, PowerShell, etc. There are many ways to write Excel files, a quick Google should throw up something that fits the tools you have available.