firesheets
v1.1.3
Published
Import data to firestore using Google sheets via CLI
Downloads
11
Readme
Firesheets
This package makes it easy use to maintain your firebase database (Firestore) using Google Sheets via CLI.
Table of Contents
Installation
Installing Build Tools as a global module will give you command-line access to all tasks available.
You can install globally by typing the following in your terminal:
npm install firesheets -gTo verified that it is successfully installed, run this:
firesheets --versionCLI Commands
You can use this command to import data from your Google Sheet and export to Firebase:
firesheets --args=<values>Arguments allowed are:
| Argument | Type | Description |
|--------|--------|--------|
| sheet.id | String | Sheet ID of your Google Sheet.
| sheet.cred | String | Full path to your Google Credential. You will need to enable your Google Sheets API. Check out here on a quick way to enable it.
| db.name| String | Name of your Firestore database.
| db.cred| String | Full path to your Firebase Credential. Check out here for more information on how to generate a private key file for your service account.
Example usage of arguments:
firesheets --sheet.id 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms --sheet.cred /Users/john/.google/credentials.json --db.name firesheets-9e63f --db.cred /Users/john/.firebase/firesheets-9e63f-firebase-adminsdk-abcdef-ghi.jsonGoogle Sheet Formatting
First row will always be used as the column name. Indicate the type next to the column name enclosed by <>.
Allowed types are (do note that they are not case sensitve):
| Type | Description |
|--------|--------|
| String | String value type, if there are no type specified in the header, this will be used as the default type.
| Number | Int/Double value type, automatically detect if there's any decimal and convert them to the correct int/double type.
| Bool | Boolean value type
| Map | Object value type, use , to separate the properties. If you need to use , in your property value, enclosed them with a double " quote.
| type[] | For array, use the type of array that you want. So if you want to use a String array, enter the value as String[], map array Map[] etc. Use , to split the values for primitive value array and use ,, for Map array.
E.g.:
| Title<String> | Description<String> | Categories<String[]> | English<Map> | Localization<Map[]> | |--------|--------|--------|--------|--------| | Hello World | This is my hello world application. | design, development | us: hello, uk: hi, sg: "what's up", | country: China, text: 你好,, country: Spain, text: hola |
This will translate to:
{
"title": "Hello World",
"description": "This is my hello world application.",
"categories": ["design", "development"],
"english": {
"us": "hello",
"uk": "hi",
"sg": "what's up"
},
"localization": [
{
"country": "China",
"text": "你好",
},
{
"country": "Spain",
"text": "hola",
}
]
}Release Notes
Please refer to the Github releases section for the changelog
More Information
Small Print
Author: Jazz Peh <[email protected]> © 2020
License: MIT - do anything with the code, but don't blame me if it does not work.
Support: if you find any problems with this module, email / tweet / open issue on Github
MIT License
Copyright (c) 2020 Jazz Peh (twitter: @jazzpeh) Licensed under the MIT license.
