use-google-sheets
Version:
### A React Hook wrapper library for google-sheets-mapper for getting data from Google Sheets API v4
34 lines (31 loc) • 943 B
TypeScript
interface SheetsOption {
id: string;
headerRowIndex?: number;
}
interface UseGoogleSheetsOptions {
apiKey: string;
sheetId: string;
sheetsOptions?: SheetsOption[];
}
interface Sheet {
id: string;
data: Record<string, unknown>[];
}
declare const Status: {
readonly pending: "pending";
readonly success: "success";
readonly error: "error";
};
type StatusType = (typeof Status)[keyof typeof Status];
interface UseGoogleSheetsState {
status: StatusType;
/** @deprecated Use `status === "pending"` instead */
loading: boolean;
error: Error | null;
data: Sheet[];
refetch: () => void;
}
declare const useGoogleSheets: ({ apiKey, sheetId, sheetsOptions, }: UseGoogleSheetsOptions) => UseGoogleSheetsState;
export { Status, useGoogleSheets as default };
export type { Sheet, SheetsOption, StatusType, UseGoogleSheetsOptions, UseGoogleSheetsState };
//# sourceMappingURL=index.d.ts.map