excellent
excellent is excel third-party program
- Read excel file and configuration file.
- To classify the matched data in setting conditions.
- Extern integration : notify email, slack, ...
Install
Requirements:
-
python
>= 3.5 -
openpyxl
: for excel data read(not support xls format) -
pyYAML
: for configuration
pypi
pip3 install exceltp
Usage
Usage: exceltp -c [file] -f [file]
-c yaml style configure file.
-f xlsx file.
-V show version.
Example:
exceltp -c config.yml -f data.xlsx
exceltp -V
Warning: not suppport xls format
Configure
analyzer
See sample/sample.yaml file
- condition in group processed as 'and' logic operation
- groups processed as 'or' logic operation
- support date column type
- date type condition
- today_equal
- toay_range_in
- toay_range_over
action
...
Quick start for Windows OS
Python install
Python 3.5 ์ด์๋ฒ์ ์ ์ค์น๊ฐ ํ์ํ๋ค. https://www.python.org/ ์ฌ์ดํธ์์ ์ค์น ํ์ผ์ ๋ค์ด๋ก๋ ๋ฐ๊ณ ์ค์นํ๋ค.
์๋์ฐ ํฐ๋ฏธ๋์ ์คํํ๊ณ pip install exceltp
๋๋ pip3 install exceltp
์ ๋ช
๋ น ๋ด๋ ค exceltp๋ฅผ ์ค์นํ๋ค.
Confiuration
์ค์ ํ์ผ์ ์์ฑํ๊ฑฐ๋ ์์ ์๋
ธํธํจ๋
๋๋ ์๋ํจ๋
๋ฅผ ์ฌ์ฉํ๋ฉด ํ๊ธ ์
๋ ฅ์ ๋ํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์๋ค.
UTF-8 ์ธ์ฝ๋ฉ์ผ๋ก ํ์ผ์ ์ ์ฅํ๊ฑฐ๋ NotePad++ ํด์ ์ค์นํด์ ์ฌ์ฉํ๋ค.
config_version: 0.1
analyzer:
- group_a:
- test1:
column_name: f
column_type: date
row_startline: 9
condition: today_equal
value: -3
- group_b:
- test2:
column_name: f
column_type: date
row_startline: 9
condition: today_equal
value: -5
action:
type: email
email_config:
subject: Book ๊ตฌ๋งค ํ์ธ ๋ฉ์ผ์
๋๋ค.
from: t_account@hotmail.com
to: to@test.com,to2@test.com
cc: to3@test.com
smtp: smtp.live.com:587
smtp_account: t_account@hotmail.com
smtp_password : ThisIsPassword
import_data: [d, e, f]
msg: |
์๋
ํ์ธ์. ์๋ฆผ๋ฉ์ผ์
๋๋ค.
์๋ ๋ด์ฉ์ ์ฐธ๊ณ ํ์ธ์.
$import_data
๊ฐ์ฌํฉ๋๋ค.
condition configure
- f์ด์ ๋ ์ง ๋ฐ์ดํฐ๋ฅผ ์กฐ๊ฑด์ผ๋ก ํ์ธํ๊ธฐ ์ํด column_name์ ๊ฐ์ f๋ก column_type์ date๋ก ์ค์ ํ๋ค.
- ์์ ์ํธ์ ๋ฐ์ดํฐ ์์์ด 9๋ฒ์งธ ๋ผ์ธ๋ถํฐ ์์ํ๊ธฐ ๋๋ฌธ์ row_startline์ 9๋ก ์ค์ ํ๋ค.
- f์ด์ ๋ ์ง๋ฐ์ดํฐ ๊ฐ์ ๋น๊ตํ์ฌ ์ค๋์ด 3์ผ์ ๋๋ 5์ผ์ ์ผ ๋ ์ฐธ์ผ๋ก ํ๋จํ๊ธฐ ์ํด 2๊ฐ์ Group์ ๋ฑ๋กํ๋ค.
action configure
- ๋ฉ์ผ ์ ์ก์ ์ฌ์ฉํ smtp ์๋ฒ์ฃผ์์ ๊ณ์ ์ ๋ณด๋ฅผ ์์ฑํ๋ค.
- subject์ msg์ ์ ์กํ ๋ฉ์ผ์ ์ ๋ชฉ๊ณผ ๋ด์ฉ์ ์์ฑํ๋ค.
- msg ๋ด์ฉ์ $import_data ํค์๋๋ฅผ ํฌํจ์ํค๋ฉด ๋ฉ์ผ ์ ์ก์ condition์ ์ผ์น๋๋ match data๋ก ๋ณ๊ฒฝํ์ฌ ์ ์กํ๋ค.
- import_data๋ match data ์ค์์ ํ์ํ ์ด๋ง ํฌํจ์ํฌ ๊ฒฝ์ฐ ์์ฑํ๋ค.
Execute
exceltp -c sample/sample.yml -f sample/sample.xlsx
* 'sample/sample.yml' config file
* 'sample/sample.xlsx' excel file
* read config file ...
* prepare analyze and action ...
* validation excel file ...
/usr/local/lib/python3.5/site-packages/openpyxl/reader/worksheet.py:322: UserWarning: Unknown extension is not supported and will be removed
warn(msg)
* process analyze ...
process 1/1 sheet name 'MA List'
* do action ...
send: 'mail FROM:<t_account@hotmail.com> size=440\r\n'
reply: b'250 2.1.0 t_account@hotmail.com....Sender OK\r\n'
reply: retcode (250); Msg: b'2.1.0 test@hotmail.com....Sender OK'
.
.
.
Job scheduler
์คํฌ๋ฆฝํธ๋ฅผ ๋ฐ๋ณต์ ์ผ๋ก ์คํํ๊ณ ์ถ๋ค๋ฉด ์๋์ฐ์์ ์ง์ํ๋ "์์ ์ค์ผ์ฅด๋ฌ"๋ฅผ ํ์ฉํ๋ค.
๋ฐฐ์นํ์ผ์ ํ์์ ๋ง๊ฒ ์์ฑํ๊ณ ํด๋น ํ์ผ์ ํธ์ถํ๋ ์์ ์ ๋ง๋ค์ด์ ์ฌ์ฉํ๋ ๊ฒ์ ๊ถ์ฅํ๋ค.