这是indexloc提供的服务,不要输入任何密码

sheets_store 2.1.1 copy "sheets_store: ^2.1.1" to clipboard
sheets_store: ^2.1.1 copied to clipboard

A simple package that allows you to use Google Sheets as cloud storage for your app.

example/main.dart

import 'dart:convert';
import 'dart:io';

import 'package:sheets_store/sheets_store.dart';

Map<String, dynamic> readJsonFile(String filePath) {
  final input = File(filePath).readAsStringSync();
  final decoded = jsonDecode(input);
  return decoded;
}

void main() async {
  final client = await SheetsClient.fromServiceAccountCredentials(
    'ENTER YOUR SPREADSHEET ID HERE',
    readJsonFile('ENTER YOUR JSON CREDENTIALS FILE HERE'),
  );
  final testTable = SheetColumn<String>(
    column: 'A',
    sheetName: 'Sheet1',
    sheetsClient: client,
    decodeFunction: (rawValue) => jsonDecode(rawValue),
  );

  // Print an element in the column
  final firstRowElement = await testTable.at(0);
  print(firstRowElement);

  // Write to the column
  testTable.set(1, 'Hello World');
}
7
likes
150
points
61
downloads

Publisher

unverified uploader

Weekly Downloads

A simple package that allows you to use Google Sheets as cloud storage for your app.

Repository (GitHub)

Topics

#server #database #spreadsheets #cloud #google

Documentation

API reference

License

MPL-2.0 (license)

Dependencies

googleapis, googleapis_auth, http

More

Packages that depend on sheets_store