# csv_to_xls
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
## Install
``` sh
pip install csv_to_xls
```
## How to use
When you install `csv_to_xls` you will get a cli tool named `csv2xls`:
``` python
!csv2xls --help
```
usage: csv2xls [-h] [--file_glob FILE_GLOB] [--out_file OUT_FILE] [--recursive]
[--delimiter DELIMITER] [--quotechar QUOTECHAR] [--symlinks]
[--file_re FILE_RE] [--folder_re FOLDER_RE]
[--skip_file_glob SKIP_FILE_GLOB] [--skip_file_re SKIP_FILE_RE]
[--skip_folder_re SKIP_FOLDER_RE]
path
Convert csv file(s) into an excel file, if multiple csvs put on tabs.
positional arguments:
path path to searching for *.csv files
optional arguments:
-h, --help show this help message and exit
--file_glob FILE_GLOB Only include files matching glob (default:
*.csv)
--out_file OUT_FILE output excel file (default: output.xlsx)
--recursive search subfolders (default: False)
--delimiter DELIMITER delimiter to use (default: ,)
--quotechar QUOTECHAR quote character to escape the delimiter
(default: ")
--symlinks follow symlinks? (default: False)
--file_re FILE_RE Only include files matching regex
--folder_re FOLDER_RE Only enter folders matching regex
--skip_file_glob SKIP_FILE_GLOB Skip files matching glob
--skip_file_re SKIP_FILE_RE Skip files matching regex
--skip_folder_re SKIP_FOLDER_RE Skip folders matching regex,
## Example
Consider the below csv files:
``` python
!ls _tests/
```
addresses.csv biostats.csv faithful.csv hw_200.csv tally_cab.csv
To merge these csvs into one excel file named `merged.xlsx`:
``` python
!csv2xls _tests/ --out_file merged.xlsx
```
We can see there is a worksheet for each filename:
``` python
import pandas as pd
pd.ExcelFile('merged.xlsx').sheet_names
```
['addresses', 'biostats', 'hw_200', 'tally_cab', 'faithful']
Let’s say we want to skip the `biostats.csv` file, we can use the
`--skip_file_re` arg:
``` python
!rm -f merged.xlsx
!csv2xls _tests/ --out_file merged.xlsx --skip_file_re 'biostats*'
```
Now that particular sheet is not there:
``` python
pd.ExcelFile('merged.xlsx').sheet_names
```
['addresses', 'hw_200', 'tally_cab', 'faithful']
Raw data
{
"_id": null,
"home_page": "https://github.com/hamelsmu/csv_to_xls",
"name": "csv-to-xls",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "nbdev jupyter notebook python",
"author": "Hamel Husain",
"author_email": "hamel.husain@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/98/bb/687ea37fdaa4a7c74494a800b428b4ec8c831a7eb76a485cabc8eb86939f/csv_to_xls-0.0.4.tar.gz",
"platform": null,
"description": "# csv_to_xls\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n## Install\n\n``` sh\npip install csv_to_xls\n```\n\n## How to use\n\nWhen you install `csv_to_xls` you will get a cli tool named `csv2xls`:\n\n``` python\n!csv2xls --help\n```\n\n usage: csv2xls [-h] [--file_glob FILE_GLOB] [--out_file OUT_FILE] [--recursive]\n [--delimiter DELIMITER] [--quotechar QUOTECHAR] [--symlinks]\n [--file_re FILE_RE] [--folder_re FOLDER_RE]\n [--skip_file_glob SKIP_FILE_GLOB] [--skip_file_re SKIP_FILE_RE]\n [--skip_folder_re SKIP_FOLDER_RE]\n path\n\n Convert csv file(s) into an excel file, if multiple csvs put on tabs.\n\n positional arguments:\n path path to searching for *.csv files\n\n optional arguments:\n -h, --help show this help message and exit\n --file_glob FILE_GLOB Only include files matching glob (default:\n *.csv)\n --out_file OUT_FILE output excel file (default: output.xlsx)\n --recursive search subfolders (default: False)\n --delimiter DELIMITER delimiter to use (default: ,)\n --quotechar QUOTECHAR quote character to escape the delimiter\n (default: \")\n --symlinks follow symlinks? (default: False)\n --file_re FILE_RE Only include files matching regex\n --folder_re FOLDER_RE Only enter folders matching regex\n --skip_file_glob SKIP_FILE_GLOB Skip files matching glob\n --skip_file_re SKIP_FILE_RE Skip files matching regex\n --skip_folder_re SKIP_FOLDER_RE Skip folders matching regex,\n\n## Example\n\nConsider the below csv files:\n\n``` python\n!ls _tests/\n```\n\n addresses.csv biostats.csv faithful.csv hw_200.csv tally_cab.csv\n\nTo merge these csvs into one excel file named `merged.xlsx`:\n\n``` python\n!csv2xls _tests/ --out_file merged.xlsx\n```\n\nWe can see there is a worksheet for each filename:\n\n``` python\nimport pandas as pd\npd.ExcelFile('merged.xlsx').sheet_names\n```\n\n ['addresses', 'biostats', 'hw_200', 'tally_cab', 'faithful']\n\nLet\u2019s say we want to skip the `biostats.csv` file, we can use the\n`--skip_file_re` arg:\n\n``` python\n!rm -f merged.xlsx\n!csv2xls _tests/ --out_file merged.xlsx --skip_file_re 'biostats*'\n```\n\nNow that particular sheet is not there:\n\n``` python\npd.ExcelFile('merged.xlsx').sheet_names\n```\n\n ['addresses', 'hw_200', 'tally_cab', 'faithful']\n\n\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "convert csvs to excel",
"version": "0.0.4",
"project_urls": {
"Homepage": "https://github.com/hamelsmu/csv_to_xls"
},
"split_keywords": [
"nbdev",
"jupyter",
"notebook",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6dd6ba97ff263097b545567a27c8438c203be58d4d15f497143b7bde0fe63082",
"md5": "330783f353864bae1458afed40282a77",
"sha256": "52c7ab6216e3b2f65d5456fcf4d25ec5fb23df030a0fadf77c34c68f24f06718"
},
"downloads": -1,
"filename": "csv_to_xls-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "330783f353864bae1458afed40282a77",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7999,
"upload_time": "2023-05-29T19:29:42",
"upload_time_iso_8601": "2023-05-29T19:29:42.197531Z",
"url": "https://files.pythonhosted.org/packages/6d/d6/ba97ff263097b545567a27c8438c203be58d4d15f497143b7bde0fe63082/csv_to_xls-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "98bb687ea37fdaa4a7c74494a800b428b4ec8c831a7eb76a485cabc8eb86939f",
"md5": "afa0e33740c89eeab96b1f25169275ee",
"sha256": "9b382e940a1ead42241f31cf153a9551189bd85565d26062362fdcc27407c9e6"
},
"downloads": -1,
"filename": "csv_to_xls-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "afa0e33740c89eeab96b1f25169275ee",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 8539,
"upload_time": "2023-05-29T19:29:43",
"upload_time_iso_8601": "2023-05-29T19:29:43.964845Z",
"url": "https://files.pythonhosted.org/packages/98/bb/687ea37fdaa4a7c74494a800b428b4ec8c831a7eb76a485cabc8eb86939f/csv_to_xls-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-29 19:29:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hamelsmu",
"github_project": "csv_to_xls",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "csv-to-xls"
}