https://github.com/pooulad/csv-convertor
🚨This program is written with GO to convert and insert your csv file in database(my-sql OR postgresql)
https://github.com/pooulad/csv-convertor
csv-parser golang tool
Last synced: about 1 month ago
JSON representation
🚨This program is written with GO to convert and insert your csv file in database(my-sql OR postgresql)
- Host: GitHub
- URL: https://github.com/pooulad/csv-convertor
- Owner: pooulad
- License: mit
- Created: 2023-10-27T11:57:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-30T09:25:42.000Z (over 2 years ago)
- Last Synced: 2025-12-31T22:43:49.647Z (6 months ago)
- Topics: csv-parser, golang, tool
- Language: Go
- Homepage:
- Size: 3.84 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Introduction👨💻
🚨This program is written with GO to convert and insert your csv file in database(my-sql OR postgresql)
## Usage
Before starting remember that your database structure should be same as your csv structure. otherwise it dosn't work.

## How to build
in the root directory:
```
go build ./cmd/main.go
```
OR download file : [build program file](https://github.com/pooulad/csv-convertor/raw/main/main)
**flags**
```
databaseType = "mysql" OR "postgres"
-type=databaseType or --type=databaseType
```
```
-config=config.json or --config=config.json
```
```
-file=file.csv or --file.csv=file.csv
```
## Config file is a json file that includes db information for insert csv
mysql sample :
```json
{
"username": "postgres",
"password": "postgres",
"host": "localhost",
"name": "exel2sqldb",
"port": "3306",
"table_name": "name",
}
```
postgres sample :
```json
{
"username": "postgres",
"password": "postgres",
"host": "localhost",
"name": "exel2sqldb",
"ssl": "disable",
"table_name": "name",
}
```
## Examples
I have prepared some examples for you that you can use
## Windows
```
go run main.go -type=postgres -file=./assets/username.csv -config=./postgres.json
```
OR
```
.\build.exe -type=postgres -file=./assets/username.csv -config=./postgres.json
```
## Linux
```
go run ./cmd/main.go -type=postgres -file=./assets/username.csv -config=./postgres.json
```
OR
```
sudo ./buildFileName ./cmd/main.go -type=postgres -file=./assets/username.csv -config=./postgres.json
```
OR
**you can use wine package too:**
```
wine start ./buildFileName -type=postgres -file=./assets/username.csv -config=./postgres.json
```
## Tech Stack
**Database:** postgresql,mysql
**Lang:** GOLANG
github.com/lib/pq
github.com/go-sql-driver/mysql
## Author
- [@pooulad](https://www.github.com/pooulad)
## Demo
