# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
from typing import List
from alibabacloud_dingtalk.doc_1_0.client import Client as dingtalkdoc_1_0Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_dingtalk.doc_1_0 import models as dingtalkdoc__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client() -> dingtalkdoc_1_0Client:
"""
Initialize the account Client using a Token.
@return: Client
@throws Exception
"""
config = open_api_models.Config()
config.protocol = 'https'
config.region_id = 'central'
return dingtalkdoc_1_0Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
client = Sample.create_client()
sheet_find_all_headers = dingtalkdoc__1__0_models.SheetFindAllHeaders()
sheet_find_all_headers.x_acs_dingtalk_access_token = '<your access token>'
find_options = dingtalkdoc__1__0_models.SheetFindAllRequestFindOptions(
match_entire_cell=True,
match_case=True,
use_reg_exp=True,
match_formula_text=True,
scope='A:A',
include_hidden=False,
union_cells=True
)
sheet_find_all_request = dingtalkdoc__1__0_models.SheetFindAllRequest(
operator_id='ppgAxxx',
select='a1Notation',
text='DingTalk',
find_options=find_options
)
try:
client.sheet_find_all_with_options('e54Lq3xxx', 'Sheet1', sheet_find_all_request, sheet_find_all_headers, util_models.RuntimeOptions())
except Exception as err:
if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
# err contains the code and message properties, which help developers locate the issue
pass
@staticmethod
async def main_async(
args: List[str],
) -> None:
client = Sample.create_client()
sheet_find_all_headers = dingtalkdoc__1__0_models.SheetFindAllHeaders()
sheet_find_all_headers.x_acs_dingtalk_access_token = '<your access token>'
find_options = dingtalkdoc__1__0_models.SheetFindAllRequestFindOptions(
match_entire_cell=True,
match_case=True,
use_reg_exp=True,
match_formula_text=True,
scope='A:A',
include_hidden=False,
union_cells=True
)
sheet_find_all_request = dingtalkdoc__1__0_models.SheetFindAllRequest(
operator_id='ppgAxxx',
select='a1Notation',
text='DingTalk',
find_options=find_options
)
try:
await client.sheet_find_all_with_options_async('e54Lq3xxx', 'Sheet1', sheet_find_all_request, sheet_find_all_headers, util_models.RuntimeOptions())
except Exception as err:
if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
# err contains the code and message properties, which help developers locate the issue
pass
if __name__ == '__main__':
Sample.main(sys.argv[1:])