石墨文档读取

登陆:https://platform.shimo.im
file
配置企业信息
file
得到Client id与Client secret
测试版本可以点击右上角体验demo按钮尝试建一个sheet文件
下面说说石墨文档的授权及sheet读取套路
先看下我们的测试表格样貌
file

let
token=Json.Document(Web.Contents("https://platform.shimodev.com/entry/oauth2/token", [Headers=[#"Content-Type"="application/json"], Content=Json.FromValue([clientId="你的clientId",clientSecret="你的clientSecret",clientUserId="注册时的邮箱或电话号码均可",grantType="client_credentials",scope="read write user",info=[fileGuid="体验demo表格唯一标志(也就是表格的网址最后斜杠后的内容)",filePermissions=[readable=true]]])]))[accessToken],
读取sheet=Excel.Workbook(Web.Contents(Text.FromBinary(Web.Contents("https://platform.shimodev.com/entry/files/体验demo表格唯一标志/export?name=test&toType=xlsx",[Headers=[Authorization="Bearer "&token,#"Content-Type"="application/json"]]))))
in
读取sheet

file
注意正式版API接口地址:https://platform.shimo.im/entry/oauth2/token
注意目前导出文档仅支持xlsx、docx、pptx
注意石墨文档的操作权限token是单独申请的,所以在授权生成token时就要指定操作文档标志及操作权限参数!!!
有个问题,在我导出word文档类型(docx)时发现文档内部的表丢失了,,,
file
file
导入文档

let
token=Json.Document(Web.Contents("https://platform.shimodev.com/entry/oauth2/token", [Headers=[#"Content-Type"="application/json"], Content=Json.FromValue([clientId="***********",clientSecret="****************",clientUserId="******",grantType="client_credentials",scope="read write user",info=""])]))[accessToken],
上传excel=Json.Document(Web.Contents("https://platform.shimodev.com/entry/files/import",[Headers=[Authorization="Bearer "&token,#"Content-Type"="application/json"],Content=Json.FromValue([name="test",type="sheet/modoc",fileBase64=Binary.ToText(File.Contents("C:\Users\Administrator\Desktop\to.xlsx"))])]))
in
上传excel

file
参考API:https://platform.shimo.im/docs/api-home/

嵌入石墨文档

<html>
<body>
<iframe src="https://platform.shimodev.com/entry/view/你的文档资源号?accessToken=你的授权token" width=1400 height=580>
</iframe>
</body>
</html>

file
powerbi报表里面嵌入直接H5那个可视化对象将html代码搞进去发布即可!
file

道高一尺 魔高一丈
https://pbihub.cn/users/44
M与DAX的恩怨纠葛