cli-kintone is a command line utility for exporting and importing kintone App data.
0.9.0
- Go 1.2 or later
- Git and Mercurial to be able to clone the packages
Getting the source code
$ cd ${GOPATH}/src
$ git clone https://github.com/kintone/cli-kintone.git
Install dependencies
$ go get github.com/kintone/go-kintone
$ go get github.com/howeyc/gopass
$ go get golang.org/x/text/encoding
build
$ cd ${GOPATH}/src/cli-kintone
$ go build
These binaries are available for download.
- Windows
- Linux
- Mac OS X
https://github.com/kintone/cli-kintone/releases
-d = "" : Domain name. Specify the FQDN.
-a = 0 : App ID.
-u = "" : User's log in name.
-p = "" : User's password.
-t = "" : API token.
-g = 0 : Guest Space ID.
-o = "csv" : Output format. Specify either 'json' or 'csv'(default).
-e = "utf-8" : Character encoding. Specify one of the following -> 'utf-8'(default), 'utf-16', 'utf-16be-with-signature', 'utf-16le-with-signature', 'sjis' or 'euc-jp'.
-U = "" : Basic authentication user name.
-P = "" : Basic authentication password.
-q = "" : Query string.
-c = "" : Fields to export (comma separated). Specify the field code name.
-f = "" : Input file path.
-b = "" : Attachment file directory.
-D = false : Delete records before insert. You can specify the deleting record condition by option "-q".
-l = 1 : Position index of data in the input file. Default is 1.
--import : Import data from stdin. If "-f" is also specified, data is imported from the file instead.
--export : Export kintone data to stdout.
$ cli-kintone -a <APP_ID> -d <FQDN> -t <API_TOKEN>
$ cli-kintone -a <APP_ID> -d <FQDN> -e sjis -c "$id, name1, name2" -t <API_TOKEN> > <OUTPUT_FILE>
$ cli-kintone --import -a <APP_ID> -d <FQDN> -e sjis -t <API_TOKEN> -f <INPUT_FILE>
Records are updated and/or added if the import file contains either an $id column (that represents the Record Number field), or a column representing a key field (denoted with a * symbol before the field code name, such as "*mykeyfield").
If the value in the $id (or key field) column matches a record number value, that record will be updated.
If the value in the $id (or key field) column is empty, a new record will be added.
If the value in the $id (or key field) column does not match with any record number values, the import process will stop, and an error will occur.
If an $id (or key field) column does not exist in the file, new records will be added, and no records will be updated.
$ cli-kintone -a <APP_ID> -d <FQDN> -t <API_TOKEN> -b mydownloads
$ cli-kintone --import -a <APP_ID> -d <FQDN> -t <API_TOKEN> -b myuploads -f <INPUT_FILE>
The key to bulk update must be specified within the INPUT_FILE by placing an * in front of the field code name,
e.g. “update_date",“*id",“status".
$ cli-kintone --import -a <APP_ID> -d <FQDN> -e sjis -t <API_TOKEN> -f <INPUT_FILE>
$ cli-kintone --import -a <APP_ID> -d <FQDN> -t <API_TOKEN> -f <INPUT_FILE> -l 25
$ printf "name,age\nJohn,37\nJane,29" | cli-kintone --import -a <APP_ID> -d <FQDN> -t <API_TOKEN>
English: https://developer.kintone.io/hc/en-us/articles/115002614853
Japanese: https://developer.cybozu.io/hc/ja/articles/202957070
- The limit of file upload size is 10 MB.
GPL v2
Copyright(c) Cybozu, Inc.