diff --git a/scripts/CSV_to_Excel/README.md b/scripts/CSV_to_Excel/README.md index cf48e19..c3afdb6 100644 --- a/scripts/CSV_to_Excel/README.md +++ b/scripts/CSV_to_Excel/README.md @@ -1,9 +1,8 @@ # CSV to EXCEL -This is a simple script that lets you convert CSV files to Excel. +This simple script will convert CSV file to Json. ## Usage -* 2 packages required pandas and openpyxl -* Use `pip install pandas` and `pip install openpyxl` -* Add path to your csv file and output excel file WITH EXTENSTION `.csv` and `.xlsx` +* required pandas package +* Use `pip install pandas` * Run `python script.py` diff --git a/scripts/csv_to_json/README.md b/scripts/csv_to_json/README.md new file mode 100644 index 0000000..cf48e19 --- /dev/null +++ b/scripts/csv_to_json/README.md @@ -0,0 +1,9 @@ +# CSV to EXCEL +This is a simple script that lets you convert CSV files to Excel. + +## Usage + +* 2 packages required pandas and openpyxl +* Use `pip install pandas` and `pip install openpyxl` +* Add path to your csv file and output excel file WITH EXTENSTION `.csv` and `.xlsx` +* Run `python script.py` diff --git a/scripts/csv_to_json/script.py b/scripts/csv_to_json/script.py new file mode 100644 index 0000000..6932150 --- /dev/null +++ b/scripts/csv_to_json/script.py @@ -0,0 +1,16 @@ +import pandas as pd +import os,json + +def csv_to_json(): + file = input("Enter csv path: ") + df = pd.read_csv(file) + name = os.path.basename(file).replace("csv", "json") + data = df.to_dict("r") + with open(name, "w") as file: + json.dump(data,file) + + print(f"file saved at {name}") + + + +csv_to_json() \ No newline at end of file