-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a7a506
commit 63e89ca
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Generate Data Member in Json | ||
on: | ||
push: | ||
branches: [master] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
generate_data_member: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Download csv file of member form in gsheet | ||
run: | | ||
curl -L -o ./scripts/dataMember.csv https://docs.google.com/spreadsheets/d/1SaXnuRt-1KXyDGS18KqU7cus4_IWNxpGhiVy0J1vz-U/export?format=csv | ||
- name: run python script to convert csv to json | ||
run: | | ||
cd ./scripts | ||
python script.py | ||
git checkout -b production | ||
cp ./dataMember.json ../data/dataMember.json | ||
cd .. | ||
rm ./scripts | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import csv | ||
import json | ||
|
||
def csv_to_json(csv_file, json_file): | ||
# Read CSV data and convert it to a list of dictionaries | ||
with open(csv_file, 'r') as csvfile: | ||
reader = csv.DictReader(csvfile) | ||
data = [row for row in reader] | ||
|
||
# Write the data to a JSON file | ||
with open(json_file, 'w') as jsonfile: | ||
json.dump(data, jsonfile, indent=4) | ||
|
||
if __name__ == "__main__": | ||
# Replace 'input.csv' with the path of your CSV file | ||
csv_file_path = 'dataMember.csv' | ||
|
||
# Replace 'output.json' with the desired path for the JSON output file | ||
json_file_path = 'dataMember.json' | ||
|
||
csv_to_json(csv_file_path, json_file_path) |