// GradeCard 选材函数 —— Power Query(M 语言) // // 适用:Excel 2016+ / Microsoft 365;公司电脑禁用宏时用这个。 // // 三步接入: // 1. 把下面 GC_KEY 换成你自己的 Key(网站 → 我的 → API Key → 新建) // 2. 数据 → 获取数据 → 其他源 → 空查询 → 高级编辑器 → 粘贴全部内容 → 完成 // 3. 把查询改名为 GradeCard,然后在单元格写 =GradeCard(A2) // 可选第二个参数:standard / est_price / process / all // // 注意:每次刷新,每一行都会调用一次接口,会消耗 API 额度。 let GC_BASE = "https://gradecard.online", GC_KEY = "把 gc_ 开头的 API Key 粘到这里", GradeCard = (need as text, optional field as text, optional rank as number) as text => let f = if field = null or field = "" then "grade" else field, r = if rank = null then 0 else rank, resp = Web.Contents(GC_BASE, [ RelativePath = "api/v1/cell", Query = [ token = GC_KEY, text = need, field = f, rank = Number.ToText(r), format = "text" ], Headers = [ #"X-API-Key" = GC_KEY ] ]), txt = Text.FromBinary(resp, 65001) in txt in GradeCard