UNPKG

sheetiq

Version:

<div align="center"> <img src="https://docapi.datafetchpro.com/featured_google_api.png" width="60%" /> <br /> <a href="https://discord.gg/ZkMMxZQf"><img src="https://img.shields.io/discord/1397785576253423616?color=5865F2&logo=discord&logoColo

80 lines (77 loc) 1.7 kB
interface SheetIQParam { token: string; } type SheetIQGetSheet = { key?: boolean; }; type SheetIQUpdateSheet = { data: string[][]; type: "append" | "update"; }; declare class SheetIQ { token: string; private baseUrl; sheet: string[]; /** * * @param p * ```ts * const sheet=new SheetIQ({token:"YOUR_BEARER_TOKEN"}) * sheet.sheet=["SHEET_ID","SHEET_NAME"] * ``` */ constructor(p: SheetIQParam); checkParameter(): void; /** * Fetches data from a Google Sheet. * * @param params - An object containing the sheet ID and range * @returns A Promise that resolves to the sheet data * * @example * ```ts * await sheet.getSheet(); * ``` * @returns [{}] Array of Object * * * @example * ```ts * await sheet.getSheet( * key:false * }) * ``` * @returns [[]] 2D Array */ getSheet(params?: SheetIQGetSheet): Promise<string[][]>; /** * Push Data on a Google Sheet. * * @param params - An object containing the sheet ID and range * @returns A Promise that resolves to the sheet data * * @example * It'll append your data at the end of sheet * ```ts * await sheet.getSheet({ * type:"append", * data:[["example@gmail.com"]] * }); * ``` * @returns `{range}` * * * @example * It'll update sheet range * * ```ts * await sheet.getSheet({ * type:"update", * data:[["example@gmail.com"]] * }); * ``` * @returns `{range}` */ updateSheet(params: SheetIQUpdateSheet): Promise<{}>; } export { SheetIQ, type SheetIQGetSheet, type SheetIQParam, type SheetIQUpdateSheet };