CSV2Excel: Convert CSV to Microsoft Excel (XLSX) file

CSV2Excel: Convert CSV to Microsoft Excel (XLSX) file

Posted by: Nitin Rajsekar

Python utility to convert csv files to Microsoft Excel file. It is supported on Windows, Linux Operating systems.

Overview

The Python utility can read multiple csv files from an input directory and create a single Microsoft Excel file with multiple worksheets corresponding to each csv file.

Python utility accepts 2 input parameters

Python csv_to_excel.py <parameter 1> <parameter 2>

Parameter 1: Input directory containing multiple CSV files
Parameter 2: Output excel file name with directory path

Example invocation

Python csv_to_excel.py /home/input_csv /home/output/output.xlsx

It is supported on Windows, Linux Operating systems.

Features

  • Python 3.x

Support

Nitin Rajsekar

Comments (1) Comment can only be posted by Signed/Logged in user

Sort: Newest | Oldest
  • Hello Nitin,

    I'm facing a syntax error while running the utility:

    File "csv_to_excel.py", line 42
        read_file.to_excel (f'{temp_dir_path}/%s.xlsx' % filename, index = None, header=True)

    We've 2.7.5 version of Python installed on our linux instance, kindly let me know if i'm missing something.