Skip to content

tpflame/csv_to_xlsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSV to XLSX Converter

English | 日本語


English

A lightweight desktop application that converts CSV files to Excel (.xlsx) format while preventing Excel's auto-formatting issues (such as stripping leading zeros from phone numbers or incorrectly parsing dates).

Features

  • Drag & Drop UI: Simply drag and drop CSV files into the window to convert them.
  • Auto Encoding Detection: Automatically detects and handles UTF-8, UTF-16, and Shift-JIS to prevent garbled text.
  • Strict Text Formatting: Specify exact column names to be strictly formatted as Text (@) in Excel. This preserves leading zeros (e.g., 09012345678) and specific date strings.

Implementations

This repository contains two implementations:

  1. Go Edition (main.go): A compact, native Windows executable (using lxn/walk).
  2. Python Edition (main.py): A PyQt5 based implementation.

How to Build (Go Edition)

The Go edition uses lxn/walk for the native Windows GUI. It requires a manifest file to be compiled into the binary.

  1. Install Go.
  2. Install the rsrc tool for compiling the manifest:
    go install github.com/akavel/rsrc@latest
  3. Compile the manifest file:
    rsrc -manifest test.manifest -o rsrc.syso
  4. Build the executable (hides the console window and reduces file size):
    go build -ldflags="-H windowsgui -s -w" -o dist/main.exe .

Usage

  1. Launch the executable (main.exe).
  2. In the text area, list the column names (one per line) that you want to explicitly format as Text.
  3. Drag and drop one or more .csv files into the window, or click "ファイルを選択" to browse.
  4. The converted .xlsx files will be saved in the same directory as the original CSV files.

日本語

CSVファイルをExcel(.xlsx)形式に変換する軽量なデスクトップアプリケーションです。Excel特有の「おせっかい機能(電話番号の先頭のゼロが消える、日付が勝手に変換されるなど)」によるデータ破損を防ぎます。

主な機能

  • ドラッグ&ドロップ対応: ウィンドウにCSVファイルをドロップするだけで一括変換できます。
  • 文字コードの自動判定: UTF-8、UTF-16、Shift-JISなどの文字コードを自動で判定し、文字化けを防ぎます。
  • 厳密な文字列フォーマット: 指定したカラム名のデータを、Excel上で強制的に「文字列(@)」として扱います。これによりゼロ落ち(例: 09012345678)や日付の誤変換を防止します。

実装について

本リポジトリには2つの実装が含まれています。

  1. Go言語版 (main.go): lxn/walk を用いた、軽量でネイティブなWindowsアプリです。
  2. Python版 (main.py): PyQt5 を用いた実装です。

ビルド方法 (Go言語版)

Go言語版はWindowsネイティブUIライブラリ lxn/walk を使用しています。ビルドにはマニフェストファイルのコンパイルが必要です。

  1. Go をインストールします。
  2. マニフェストコンパイル用のツール rsrc をインストールします。
    go install github.com/akavel/rsrc@latest
  3. マニフェストファイルをコンパイルします。
    rsrc -manifest test.manifest -o rsrc.syso
  4. 実行ファイルをビルドします(黒いコンソール画面を非表示にし、ファイルサイズを削減します)。
    go build -ldflags="-H windowsgui -s -w" -o dist/main.exe .

使い方

  1. 実行ファイル(main.exe)を起動します。
  2. テキストエリアに、強制的に文字列として扱いたいカラム名(ヘッダー名)を改行区切りで入力します。
  3. .csv ファイルを画面にドラッグ&ドロップするか、「ファイルを選択」ボタンから選択します。
  4. 元のCSVファイルと同じフォルダに、変換後の .xlsx ファイルが出力されます。

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors