Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bilal-fazlani/ExcelToSqlScripts
A small command line tool to help you convert data of excel files into insert statements in SQL syntax.
https://github.com/bilal-fazlani/ExcelToSqlScripts
convert dotnet excel excel-to-sql script sql
Last synced: 3 months ago
JSON representation
A small command line tool to help you convert data of excel files into insert statements in SQL syntax.
- Host: GitHub
- URL: https://github.com/bilal-fazlani/ExcelToSqlScripts
- Owner: bilal-fazlani
- Created: 2017-04-14T18:41:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-13T16:16:02.000Z (over 1 year ago)
- Last Synced: 2024-07-31T12:32:47.838Z (3 months ago)
- Topics: convert, dotnet, excel, excel-to-sql, script, sql
- Language: C#
- Homepage:
- Size: 743 KB
- Stars: 34
- Watchers: 5
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - bilal-fazlani/ExcelToSqlScripts - A small command line tool to help you convert data of excel files into insert statements in SQL syntax. (C# #)
README
[![Nuget](https://img.shields.io/nuget/v/ExcelToSqlScripts.Console?label=Latest%20Nuget%20Version&style=for-the-badge)](https://www.nuget.org/packages/ExcelToSQLScripts.Console)
# Setup instructions
This small command line tool to help you convert data of excel files into insert statements in SQL syntax.
1. Navigate to [dotnet core website](https://www.microsoft.com/net/core) and follow instructions to install dotnet core
2. `dotnet tool install -g ExcelToSQLScripts.Console`
3. `excel2sql --help`Note: Ensure that you have `~/.dotnet/tools` path added in your $PATH variable
# Generating SQL scripts
You can generate 3 types of scripts i.e. insert scipts, update scripts & merge scripts.
##### Sample Input
![Excel](https://raw.githubusercontent.com/bilal-fazlani/ExcelToSqlScripts/master/Readme/Sample_Input.png)
### Insert scripts
```
excel2sql insert -i -o
```##### Sample Output
```sql
INSERT INTO EMPLOYEES (ID, NAME, LOCATION) VALUES (1, 'John', 'India');
INSERT INTO EMPLOYEES (ID, NAME, LOCATION) VALUES (2, 'Jason', 'US');
```### Update scripts
```
excel2sql update -i -o
```##### Sample Output
```sql
UPDATE EMPLOYEES SET NAME = 'John', LOCATION = 'India' WHERE ID = 1;
UPDATE EMPLOYEES SET NAME = 'Jason', LOCATION = 'US' WHERE ID = 2;
```### Merge scripts
```
excel2sql merge -i -o
```##### Sample Output
```sql
MERGE INTO EMPLOYEES T
USING (SELECT 1 ID, 'John' NAME, 'India' LOCATION FROM DUAL) D
ON (T.ID = D.ID)
WHEN MATCHED THEN
UPDATE SET T.NAME = D.NAME, T.LOCATION = D.LOCATION
WHEN NOT MATCHED THEN
INSERT (ID, NAME, LOCATION) VALUES (D.ID, D.NAME, D.LOCATION);MERGE INTO EMPLOYEES T
USING (SELECT 2 ID, 'Jason' NAME, 'US' LOCATION FROM DUAL) D
ON (T.ID = D.ID)
WHEN MATCHED THEN
UPDATE SET T.NAME = D.NAME, T.LOCATION = D.LOCATION
WHEN NOT MATCHED THEN
INSERT (ID, NAME, LOCATION) VALUES (D.ID, D.NAME, D.LOCATION);
```