npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

feishu-sheet-api

v1.0.1

Published

一个基于nodejs实现的飞书表格读取工具

Downloads

8

Readme

飞书表格数据读取工具

该工具支持使用 accessToken,sheetId,worksheets 获取飞书表格的数据并转成比较友好的格式;

适用于将飞书表格作为数据库的场景。

使用说明

1、作为依赖安装在项目中

npm install feishu-sheet-api --save
# or
yarn add feishu-sheet-api --save

2、代码中使用

import { getFeishuSheetData, formatSheetData } from "feishu-sheet-api";

getFeishuSheetData({
  accessToken: "xxx",
  sheetId: "xxx",
  worksheets: ["xxx"],
  maxColumn: 100,
})
  .then((resp) => {
    require("fs").writeFileSync(
      "data.json",
      JSON.stringify(formatSheetData(resp))
    );
  })
  .catch((err) => {
    console.log(err.message);
  });

3、返回的数据

// 原始数据,一般不使用这个数据,除非高级自定义展示
declare interface ISheetRawData {
  majorDimension: string; // 飞书返回
  range: string; // 飞书返回
  title: string; // 表格tab的名称
  revision: number; // 飞书返回
  values: any[][]; // 表格二维数组
}
// 格式化之后的数据
declare interface ISheetFormattedData {
  title: string; // 表格tab的名称
  data: Record<string, any>[]; // 一维数组,元素是普通对象
}

参数说明

| 名称 | 类型 | 必填 | 说明 | 默认值 | |-------------|----------|-----|--------------------|-----| | accessToken | string | 是 | 飞书登录后的 accessToken | 无 | | sheetId | string | 是 | 表格 id | | | worksheets | string[] | 是 | 表格 tab 列表 | | | maxColumn | number | 否 | 获取的最大列 | 100 |

参数取值说明

img.png

① 划线的部分(不包括#之后的内容)是 sheetId;
② 框选的部分是 worksheets,字符串数组;

使用问题欢迎在github进行反馈:https://github.com/gslnzfq/feishu-sheet/issues