https://github.com/theapache64/fig
Use Google sheet as remote config
https://github.com/theapache64/fig
android config-lib google-sheets jvm
Last synced: 2 months ago
JSON representation
Use Google sheet as remote config
- Host: GitHub
- URL: https://github.com/theapache64/fig
- Owner: theapache64
- Created: 2024-06-24T16:39:41.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-07-05T17:37:13.000Z (10 months ago)
- Last Synced: 2025-02-02T05:53:05.245Z (3 months ago)
- Topics: android, config-lib, google-sheets, jvm
- Language: Kotlin
- Homepage: https://github.com/theapache64/fig
- Size: 180 KB
- Stars: 158
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# fig
> Use Google sheet as remote config
### ✨ Demo
**Sheet:**
**Code:**
```kotlin
suspend fun main() {
val fig = Fig()
fig.init(sheetUrl = "https://docs.google.com/spreadsheets/d/../edit?usp=sharing") // your Google sheet URL
println("Fruit is '${fig.getValue("fruit", null)}'")
}
```**Output:**
```
Fruit is 'apple'
```## ⌨️ Usage
1. 📄 Create a Google Sheet with two columns `key` and `value`
2. 🔗 Choose "Anyone with link" and copy the link
3. 🤝 Add dependency

```kotlin
repositories {
maven { url = uri("https://jitpack.io") }
}dependencies {
implementation("com.github.theapache64:fig:0.0.3")
}
```Groovy:
```groovy
repositories {
maven { url 'https://jitpack.io' } // Add jitpack
}
dependencies {
implementation 'com.github.theapache64:fig:0.0.3'
}
```4. ⌨️ Use `Fig.init` and `Fig.getValue`
```kotlin
suspend fun main() {
val fig = Fig()
fig.init(sheetUrl = "YOUR-GOOGLE-SHEET-URL-GOES-HERE")
println("Fruit is '${fig.getValue("fruit", null)}'")
}
```5. 💻 **Output**
```
Fruit is 'apple'
```## ▶️ Video Tutorial
If you want to see this library in practice, you can check out this video tutorial on YouTube: https://youtu.be/E8X94pCJ2zs## 🚫 Limitations
- Your value field can't have two data types. To solve this always wrap your number inputs with `TO_TEXT` function. Eg: `=TO_TEXT("2.4")`
- This library uses an unofficial Google Sheets API to fetch data, which may stop working at any time. It's best to use this library only for small projects where you need quick, dynamic values without setting up something like Firebase (and honestly, most of my projects use this library as a config source and database, so if it crashes, I'll be crying right alongside you).## ✍️ Author
👤 **theapache64**
* Twitter: @theapache64
* Email: [email protected]Feel free to ping me 😉
## 🤝 Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any
contributions you make are **greatly appreciated**.1. Open an issue first to discuss what you would like to change.
1. Fork the Project
1. Create your feature branch (`git checkout -b feature/amazing-feature`)
1. Commit your changes (`git commit -m 'Add some amazing feature'`)
1. Push to the branch (`git push origin feature/amazing-feature`)
1. Open a pull requestPlease make sure to update tests as appropriate.
## ❤ Show your support
Give a ⭐️ if this project helped you!
## 📝 License
```
Copyright © 2024 - theapache64Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```_This README was generated by [readgen](https://github.com/theapache64/readgen)_ ❤