Skip to content

HampB/csv2excel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csv2excel

csv2excel is a CLI tool written in Go that allows you to convert CSV files to Excel format. It supports specifying the input CSV file, output Excel file, and the delimiter used in the CSV file. Additionally, it can infer and convert column types from strings to integers or floats.

Note: This is my first Go project, and I appreciate any feedback or contributions to improve it.

Features

  • Convert CSV files to Excel format
  • Specify custom delimiters for CSV files
  • Infer and convert column types (string to integer or float)
  • Specify output file name or path
  • Merge multiple CSV files into a single Excel file

Installation

To install csv2excel, you need to have Go installed on your machine. Then, you can use the following command to install the tool:

go install github.com/HampB/csv2excel@latest

Usage

You can use the csv2excel command to convert a CSV file to an Excel file. Below are the available options:

csv2excel -i <input-file> -o <output-file> -d <delimiter> -c

Options

  • -i, --input: Path to the input CSV file (required)
  • -o, --output: Path to the output Excel file (optional)
  • -n, --name: Name of the output Excel file (optional)
  • -d, --delimiter: Delimiter for CSV file (default is ,)
  • -c, --convert: Convert column types to inferred types (optional)

Merge Command Options

The merge command allows you to combine multiple CSV files into a single Excel file. Below are the available options:

csv2excel merge -f <file1.csv,file2.csv> -F <folder> -o <output-file> -d <delimiter> -c
  • -f, --files: List of CSV files to merge (comma-separated)
  • -F, --folder: Path to the folder containing CSV files
  • -o, --output: Path to the output Excel file (required)
  • -d, --delimiter: Delimiter for CSV file (default is ,)
  • -c, --convert: Convert column types to inferred types (optional)

Examples

Convert a CSV file to an Excel file with default settings:

csv2excel -i data.csv

Convert a CSV file with a custom delimiter and infer column types:

csv2excel -i data.csv -d ";" -c

Specify the output file name:

csv2excel -i data.csv -n output

Specify the full path for the output file:

csv2excel -i data.csv -o /path/to/output.xlsx

Merge multiple CSV files into a single Excel file:

csv2excel merge -f file1.csv,file2.csv -o merged.xlsx

Merge all CSV files in a folder into a single Excel file:

csv2excel merge -F /path/to/csvfiles -o merged.xlsx

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

CLI tool to convert csv files to excel

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages