""" @author: luojunhui 从飞书表读取公式 """ import json from feishu import Feishu F = Feishu(document_token="ZYNBsZ5lPhsKFltb6ghclfJqngb") config_json = {} w = F.search_value(sheet_id="TVBdUl", ab="A5:NA5") result = w['data']['valueRange'] for index, i in enumerate(result['values'][0], 1): if type(i) == str and i != "-" and i != "--": print("c{}".format(index), "={}".format(i)) key = "c{}".format(index) alg = "={}".format(i) config_json[key] = alg with open('config.json', 'w') as f: f.write(json.dumps(config_json, ensure_ascii=False, indent=4))