Try sending the aggregated results of two records by email with pykintone

Kintone can be easily aggregated, but it is not easy to calculate the addition or subtraction of two different record values. So, based on the statistical information recorded every week, I created a program that notifies me of the difference from last week.

** As a result, good things **

――I don't have to use a calculator anymore --No longer exports to Excel every week and aggregates ――I got better just by looking at the email (if I run it regularly)

Thing you want to do

1. Calculate the difference between the values in the kintone app

20170529-16-5_No-00.png

2. Send email (regular)

20170529-16-36_No-00.png

Creating an environment

This program runs in Python, so let's prepare for the following.

--OS: Ubuntu (I used Cloud9)

Kintone app settings

FieldCode FieldType DefaltValue
Date Date Today
Member Number 0
PV Number 0
UU Number 0

Commentary

See ** kintone-indicator **

account.yaml

domain: {Subdomain name}
apps:
    send:
        id: {App ID}
        token: {App API token}

settings.yaml

mail:
    smtp: {SMTP server}
    port: {port number}
    to: {Destination Email Address}
    from: {Sender's email address}
    password: {Sender's Email password * Blank if not needed}

Shell script execution and sample results

python


$ sudo sh indicator/run.sh 
Between 2017-06-05 and 2017-05-29
Members: 7,000 (+2,150)
PV: 6,000
UU: 400

Send to mail >>xxx@*****.***

It was sent to the specified email address ♪ I think it will be even more convenient if IM such as Slack is notified in addition to email.

Recommended Posts

Try sending the aggregated results of two records by email with pykintone
Try sending an email with the Gmail API Client Library for Java
Approximation by the least squares method of a circle with two fixed points
Try to get the contents of Word with Golang
Try to import to the database by manipulating ShapeFile of national land numerical information with Python
Try scraping the data of COVID-19 in Tokyo with Python
Save the output of GAN one by one ~ With the implementation of GAN by PyTorch ~
Visualize the results of decision trees performed with Python scikit-learn
Try to automate the operation of network devices with Python
Try to extract the features of the sensor data with CNN
Reuse the results of clustering
Try to solve the N Queens problem with SA of PyQUBO
[GWAS] Plot the results of principal component analysis (PCA) by PLINK
I tried sending an email from the Sakura server with flask-mail