I want to convert a file in tsv format to xls/xlsx..
I tried using
os.rename("sample.tsv","sample.xlsx")
But the file getting converted is corrupted. Is there any other method of doing it?
I want to convert a file in tsv format to xls/xlsx..
I tried using
os.rename("sample.tsv","sample.xlsx")
But the file getting converted is corrupted. Is there any other method of doing it?
You need:
Read the data from the
tsv
file.Convert it in what you want them to be.
Write them to an Excel file with openpyxl for
xlsx
or xlwt forxls
.Here is a simple example of converting TSV to XLSX using XlsxWriter and the core csv module: