Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

飞书表格修改sheet title 失败 #133

Open
gllxdxw075 opened this issue May 20, 2024 · 1 comment
Open

飞书表格修改sheet title 失败 #133

gllxdxw075 opened this issue May 20, 2024 · 1 comment

Comments

@gllxdxw075
Copy link

package test

import (
        "context"
        "fmt"
        "net/http"
        "testing"

        lark "github.com/larksuite/oapi-sdk-go/v3"
        larkcore "github.com/larksuite/oapi-sdk-go/v3/core"
        larksheets "github.com/larksuite/oapi-sdk-go/v3/service/sheets/v3"
)

func TestFeshu(t *testing.T) {
        header := http.Header{}
        header.Add("Authorization", "my user token")
        cli := lark.NewClient(
                "id", "sec",
                lark.WithHeaders(header))
        resp, err := cli.Sheets.V3.Spreadsheet.Patch(
                context.Background(),
                larksheets.NewPatchSpreadsheetReqBuilder().
                        SpreadsheetToken("sheettoken").
                        UpdateSpreadsheetProperties(
                                larksheets.
                                        NewUpdateSpreadsheetPropertiesBuilder().
                                        Title("test").Build(),
                        ).Build())
        //处理错误
        if err != nil {
                // 处理err
                return
        }

        // 服务端错误处理
        if !resp.Success() {
                fmt.Println(resp.Code, resp.Msg, resp.RequestId())
                return
        }

        // 业务数据处理
        fmt.Println(larkcore.Prettify(resp.RawBody))
}

按照上面的测试(替换对应的ID和TOKEN),会报错Access denied. One of the following scopes is required: [sheets:spreadsheet, drive:drive]

@gllxdxw075
Copy link
Author

备注:

  • 使用的是自定义应用的ID 和TOKEN,未上线
  • 使用的sheet在个人下是有权限的, 走官方API文档的调试台下的CURL示例是可以通的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant