# convert-fileformat-with-pandas
Convert file format with [pandas](https://pandas.pydata.org/).
[![Build Status](https://app.travis-ci.com/kurusugawa-computer/convert-fileformat-with-pandas.svg?branch=main)](https://app.travis-ci.com/kurusugawa-computer/convert-fileformat-with-pandas)
[![PyPI version](https://badge.fury.io/py/convpandas.svg)](https://badge.fury.io/py/convpandas)
[![Python Versions](https://img.shields.io/pypi/pyversions/convpandas.svg)](https://pypi.org/project/convpandas/)
# Requirements
* Python 3.9+
# Install
```
$ pip install convpandas
```
https://pypi.org/project/convpandas/
# Usage
## csv2xlsx
Convert csv file to xlsx file.
```
$ convpandas csv2xlsx --help
usage: convpandas csv2xlsx [-h] [--sep SEP] [--encoding ENCODING] [--quotechar QUOTECHAR] [--numeric_to_string] [--sheet_name SHEET_NAME [SHEET_NAME ...]]
csv_files [csv_files ...] xlsx_file
positional arguments:
csv_files
xlsx_file
optional arguments:
-h, --help show this help message and exit
--sep SEP Delimiter to use when reading csv. (default: ,)
--encoding ENCODING Encoding to use when reading csv. List of Python standard encodings.
https://docs.python.org/3/library/codecs.html#standard-encodings (default: utf-8)
--quotechar QUOTECHAR
The character used to denote the start and end of a quoted item when reading csv. (default: ")
--numeric_to_string If specified, write numeric value as string type. If not specified, write numeric value as numeric type. (default: False)
--sheet_name SHEET_NAME [SHEET_NAME ...]
```
Convert `in.csv` to `out.xlsx` .
```
$ convpandas csv2xlsx in.csv out.xlsx
```
When `CSV_FILE` is `-` , STDIN is used for input.
```
$ convpandas csv2xlsx - out.xlsx < in.csv
```
Convert `in1.csv` and `in2.csv` to `out.xlsx` . Sheet name is csv filename without its' suffix.
```
$ convpandas csv2xlsx in1.csv in2.csv out.xlsx
```
![](docs/img/output_xlsx_file_from_multiple_csv.png)
If `--sheet_name` is specified, sheet name is set.
```
$ convpandas csv2xlsx in1.csv in2.csv out.xlsx --sheet_name foo bar
```
![](docs/img/output_xlsx_file_from_multiple_csv2.png)
## xlsx2csv
Convert xlsx file to csv file.
```
$ convpandas xlsx2csv --help
usage: convpandas xlsx2csv [-h] [--sheet_name SHEET_NAME] [--sep SEP] [--encoding ENCODING] [--quotechar QUOTECHAR] xlsx_file csv_file
positional arguments:
xlsx_file
csv_file
optional arguments:
-h, --help show this help message and exit
--sheet_name SHEET_NAME
Sheet name when reading xlsx. If not specified, read 1st sheet. (default: None)
--sep SEP Field delimiter for the output file. (default: ,)
--encoding ENCODING A string representing the encoding to use in the output file. (default: utf-8)
--quotechar QUOTECHAR
Character used to quote fields. (default: ")
```
Convert `in.xlsx` to `out.csv` .
```
$ convpandas csv2xlsx in.xlsx out.csv
```
When `CSV_FILE` is `-` , write to STDOUT.
```
$ convpandas csv2xlsx in.xlsx -
name,age
Alice,23
```
With specifying `--sheet_name`, you can select sheet name that you want to convert.
```
$ convpandas csv2xlsx in.xlsx out.csv --sheet_name sheet2
```
# Usage for Developer
Refer to https://github.com/kurusugawa-computer/convert-fileformat-with-pandas/blob/main/README_for_developer.md .
Raw data
{
"_id": null,
"home_page": "https://github.com/kurusugawa-computer/convert-fileformat-with-pandas.git",
"name": "convpandas",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "pandas,csv,xlsx,excel",
"author": "Kurusugawa Computer Inc.",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/4d/5d/02e2ef17b33593c1459fbc018a86f8772ca4cea6d2756940cd649c10a005/convpandas-0.3.5.tar.gz",
"platform": null,
"description": "# convert-fileformat-with-pandas\nConvert file format with [pandas](https://pandas.pydata.org/).\n\n[![Build Status](https://app.travis-ci.com/kurusugawa-computer/convert-fileformat-with-pandas.svg?branch=main)](https://app.travis-ci.com/kurusugawa-computer/convert-fileformat-with-pandas)\n[![PyPI version](https://badge.fury.io/py/convpandas.svg)](https://badge.fury.io/py/convpandas)\n[![Python Versions](https://img.shields.io/pypi/pyversions/convpandas.svg)](https://pypi.org/project/convpandas/)\n\n# Requirements\n* Python 3.9+\n\n# Install\n\n```\n$ pip install convpandas\n```\n\nhttps://pypi.org/project/convpandas/\n\n\n# Usage\n\n## csv2xlsx\nConvert csv file to xlsx file.\n\n```\n$ convpandas csv2xlsx --help\nusage: convpandas csv2xlsx [-h] [--sep SEP] [--encoding ENCODING] [--quotechar QUOTECHAR] [--numeric_to_string] [--sheet_name SHEET_NAME [SHEET_NAME ...]]\n csv_files [csv_files ...] xlsx_file\n\npositional arguments:\n csv_files\n\n xlsx_file\n\noptional arguments:\n -h, --help show this help message and exit\n\n --sep SEP Delimiter to use when reading csv. (default: ,)\n\n --encoding ENCODING Encoding to use when reading csv. List of Python standard encodings.\n https://docs.python.org/3/library/codecs.html#standard-encodings (default: utf-8)\n\n --quotechar QUOTECHAR\n The character used to denote the start and end of a quoted item when reading csv. (default: \")\n\n --numeric_to_string If specified, write numeric value as string type. If not specified, write numeric value as numeric type. (default: False)\n\n --sheet_name SHEET_NAME [SHEET_NAME ...]\n```\n\n\nConvert `in.csv` to `out.xlsx` .\n\n```\n$ convpandas csv2xlsx in.csv out.xlsx\n```\n\n\nWhen `CSV_FILE` is `-` , STDIN is used for input. \n\n```\n$ convpandas csv2xlsx - out.xlsx < in.csv\n```\n\nConvert `in1.csv` and `in2.csv` to `out.xlsx` . Sheet name is csv filename without its' suffix. \n\n```\n$ convpandas csv2xlsx in1.csv in2.csv out.xlsx\n```\n\n![](docs/img/output_xlsx_file_from_multiple_csv.png)\n\nIf `--sheet_name` is specified, sheet name is set.\n\n```\n$ convpandas csv2xlsx in1.csv in2.csv out.xlsx --sheet_name foo bar\n```\n\n![](docs/img/output_xlsx_file_from_multiple_csv2.png)\n\n## xlsx2csv\nConvert xlsx file to csv file.\n\n```\n$ convpandas xlsx2csv --help\nusage: convpandas xlsx2csv [-h] [--sheet_name SHEET_NAME] [--sep SEP] [--encoding ENCODING] [--quotechar QUOTECHAR] xlsx_file csv_file\n\npositional arguments:\n xlsx_file\n\n csv_file\n\noptional arguments:\n -h, --help show this help message and exit\n\n --sheet_name SHEET_NAME\n Sheet name when reading xlsx. If not specified, read 1st sheet. (default: None)\n\n --sep SEP Field delimiter for the output file. (default: ,)\n\n --encoding ENCODING A string representing the encoding to use in the output file. (default: utf-8)\n\n --quotechar QUOTECHAR\n Character used to quote fields. (default: \")\n```\n\n\nConvert `in.xlsx` to `out.csv` .\n\n```\n$ convpandas csv2xlsx in.xlsx out.csv\n```\n\n\nWhen `CSV_FILE` is `-` , write to STDOUT. \n\n```\n$ convpandas csv2xlsx in.xlsx -\nname,age\nAlice,23\n```\n\nWith specifying `--sheet_name`, you can select sheet name that you want to convert.\n\n```\n$ convpandas csv2xlsx in.xlsx out.csv --sheet_name sheet2\n```\n\n\n# Usage for Developer\nRefer to https://github.com/kurusugawa-computer/convert-fileformat-with-pandas/blob/main/README_for_developer.md .\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Convert file format with pandas",
"version": "0.3.5",
"project_urls": {
"Homepage": "https://github.com/kurusugawa-computer/convert-fileformat-with-pandas.git",
"Repository": "https://github.com/kurusugawa-computer/convert-fileformat-with-pandas.git"
},
"split_keywords": [
"pandas",
"csv",
"xlsx",
"excel"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "97305eefd0e88276536e017a89d8c7259ed0adc95eb833b22349cdd96b82c1ea",
"md5": "bae471021b994a3e6b21dfaadd9e6b19",
"sha256": "6d9b1273b06bc804394a4d221a93b2aba9e69f2adb866d18a31656cdd90769f3"
},
"downloads": -1,
"filename": "convpandas-0.3.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bae471021b994a3e6b21dfaadd9e6b19",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 8224,
"upload_time": "2024-03-04T07:31:08",
"upload_time_iso_8601": "2024-03-04T07:31:08.494340Z",
"url": "https://files.pythonhosted.org/packages/97/30/5eefd0e88276536e017a89d8c7259ed0adc95eb833b22349cdd96b82c1ea/convpandas-0.3.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4d5d02e2ef17b33593c1459fbc018a86f8772ca4cea6d2756940cd649c10a005",
"md5": "ab0161d43c5e566b63a1ce10485800d9",
"sha256": "6ae42104f03c872c8e9b90efa41d57131f842064910da92ecb2ec33bb9ebb4c9"
},
"downloads": -1,
"filename": "convpandas-0.3.5.tar.gz",
"has_sig": false,
"md5_digest": "ab0161d43c5e566b63a1ce10485800d9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 7081,
"upload_time": "2024-03-04T07:31:10",
"upload_time_iso_8601": "2024-03-04T07:31:10.075171Z",
"url": "https://files.pythonhosted.org/packages/4d/5d/02e2ef17b33593c1459fbc018a86f8772ca4cea6d2756940cd649c10a005/convpandas-0.3.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-04 07:31:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kurusugawa-computer",
"github_project": "convert-fileformat-with-pandas",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"lcname": "convpandas"
}