Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
6
Help us understand the problem. What is going on with this article?
@PowerBIxyz

kintone REST API + Power Queryでレコードを取得する

More than 1 year has passed since last update.

Excel + Power Query + kintone REST API でレコードを取得する。アドホック的な使い方であればまぁそこそこよい感じ。

使ったもの

  • Excel 2016 と Power Query エディター
  • kintone 試用版 のサンプルアプリ(顧客管理)
    • APIトークン

Power Query エディターで

let
    APIHost = "https://****.cybozu.com", APIToken = "<取得済APIToken>",
    JSONviaAPI =
        Json.Document(
            Web.Contents(
                Uri.Combine(
                    APIHost, "k/v1/records.json"
                ),
                [
                    Query = [ 
                        App = "2",
                        Query = "order by レコード番号 asc limit 10 offset 10"
                    ],
                    Headers=[ #"X-Cybozu-API-Token" = APIToken ]
                ]
            )
        ),
    TableFromRecords = Table.FromRecords( JSONviaAPI[records] ),
    ColumnNames = Table.ColumnNames( TableFromRecords ),
    TransformColumns1 =
        Table.TransformColumns(
            TableFromRecords,
            List.Zip( {
                ColumnNames,
                List.Repeat(
                    { each _[value] },
                    List.Count( ColumnNames )
                )
            } )
        ),
    TransformColumns2 =
        Table.TransformColumns(
            TransformColumns1,
            {
                { "更新者", each _[name] },
                { "作成者", each _[name] }
            },
            null, MissingField.Ignore
        )
in
    TransformColumns2

途中こんな感じになるけど慌てなくて大丈夫。
image.png

データ型はよく吟味してから
image.png

500件の制限については、List.Generate 関数 使って解決の方針。

その他

6
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
PowerBIxyz
#PowerBI とか #PowerQuery とか Microsoft MVP for Data Platform (2016,2017-2018,2018-2019,2019-2020,2020-2021), Access (2011-2015)

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
6
Help us understand the problem. What is going on with this article?