• Stars
    star
    767
  • Rank 57,170 (Top 2 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created almost 4 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📃 Turn Google Spreadsheet to JSON endpoint (for Android and JVM) for FREE (100%)

retrosheet 📄

Turn Google Spreadsheet to JSON endpoint. [For Android and JVM].

https://github.com/theapache64/notes

Benefits 🤗

  • No worries about server health because you're using Google's server 😋
  • Enjoy rapid response times and unlimited bandwidth.
  • Easily migrate to your REST API without significant code changes.
  • No need to create an admin panel or dashboard to control the data; simply use the Google Spreadsheet app on the web or mobile.
  • Accelerate your Proof of Concept (POC) or Minimum Viable Product (MVP) development with this library.

Install 🤝

latestVersion

repositories {
  maven { url 'https://jitpack.io' } // Add jitpack
}

dependencies {
  implementation 'com.github.theapache64:retrosheet:latest.version'
}

Usage ⌨️

How to write data ? ✍️

Step 1 : Writing Data To Sheet

Step 2

  • Select response destination and select/create a Google sheet to store the responses.

Step 3

  • Now you can open the sheet and change sheet name and column names if you want. This is just to make the Google sheet table look like a real database table (optional)

I've changed to

Step 4

  • Next, Press the Send button and copy the form link

Step 5

  • Now let's go to our code and create our RetrosheetInterceptor
val retrosheetInterceptor = RetrosheetInterceptor.Builder()
    .setLogging(false)
    // To Read
    .addSheet(
        "notes", // sheet name
        "created_at", "title", "description" // columns in same order
    )
    // To write
    .addForm(
        ADD_NOTE_ENDPOINT,
        "https://docs.google.com/forms/d/e/1FAIpQLSdmavg6P4eZTmIu-0M7xF_z-qDCHdpGebX8MGL43HSGAXcd3w/viewform?usp=sf_link" // form link
    )
    .build()

Step 6

  • Next, let's create a normal Retrofit API interface
interface NotesApi {

    @Read("SELECT *") 
    @GET("notes") // sheet name
    suspend fun getNotes(): List<Note>

    @Write
    @POST(ADD_NOTE_ENDPOINT) // form name
    suspend fun addNote(@Body addNoteRequest: AddNoteRequest): AddNoteRequest
}
  • @Write : To write data to a sheet

  • @Read : To read data from a sheet.

You can lean more about query language from here : https://developers.google.com/chart/interactive/docs/querylanguage.

NOTE: You can use your column name in the query rather than using column letter such as A,B,C etc.

How to read data ? 📖

Step 7 : Reading data from Sheet

  • We're done configuring the writing part. Now let's finish the reading part. Create/open a google sheet, (it can be either form connected, or a simple Google sheet).

  • Press Share and copy the link

copy-link

Step 8

  • Remove contents after the last forward slash from the copied link.

For example, this

https://docs.google.com/spreadsheets/d/1IcZTH6-g7cZeht_xr82SHJOuJXD_p55QueMrZcnsAvQ/edit?usp=sharing

would become this

https://docs.google.com/spreadsheets/d/1IcZTH6-g7cZeht_xr82SHJOuJXD_p55QueMrZcnsAvQ/

Step 9

  • Finally, Set the Retrofit or OkHttp's baseUrl with the above link.

baseUrl

Done 👍

Full Example 🌟

import com.squareup.moshi.Moshi
import com.github.theapache64.retrosheet.RetrosheetInterceptor
import kotlinx.coroutines.runBlocking
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory

/**
 * Created by theapache64 : Jul 21 Tue,2020 @ 02:11
 */
fun main() = runBlocking {
  
    // Building Retrosheet Interceptor
    val retrosheetInterceptor = RetrosheetInterceptor.Builder()
        .setLogging(false)
        // To Read
        .addSheet(
            "notes", // sheet name
            "created_at", "title", "description" // columns in same order
        )
        // To write
        .addForm(
            "add_note",
            "https://docs.google.com/forms/d/e/1FAIpQLSdmavg6P4eZTmIu-0M7xF_z-qDCHdpGebX8MGL43HSGAXcd3w/viewform?usp=sf_link" // form link
        )
        .build()

    // Building OkHttpClient 
    val okHttpClient = OkHttpClient.Builder()
        .addInterceptor(retrosheetInterceptor) // and attaching interceptor
        .build()


    val moshi = Moshi.Builder().build()

    // Building retrofit client
    val retrofit = Retrofit.Builder()
        // with baseUrl as sheet's public URL    
        .baseUrl("https://docs.google.com/spreadsheets/d/1YTWKe7_mzuwl7AO1Es1aCtj5S9buh3vKauKCMjx1j_M/") // Sheet's public URL
        // and attach previously created OkHttpClient
        .client(okHttpClient)
        .addConverterFactory(MoshiConverterFactory.create(moshi))
        .build()

    // Now create the API interface
    val notesApi = retrofit.create(NotesApi::class.java)
  
    // Reading notes
    println(notesApi.getNotes())

    // Adding note
    val addNote = notesApi.addNote(
        AddNoteRequest("Dynamic Note 1", "Dynamic Desc 1")
    )
    println(addNote)
    Unit
}

Samples 🌠

Contributing

This project is applying ktlint (without import ordering since it's conflicted with IDE's format). Before creating a PR, please make sure your code is aligned with ktlint (./gradlew ktlint). We can run auto-format with:

./gradlew ktlintFormat

Retrosheet JS

  • Coming Soon

Author ✍️

  • theapache64

More Repositories

1

stackzy

💻 A cross-platform desktop application to identify libraries used inside an android application. Made possible by Compose Desktop ⚡
Kotlin
999
star
2

create-compose-app

⌨️ A tool that gives you a massive head start when building Compose based apps. It saves you from time-consuming setup and configuration
Kotlin
495
star
3

rebugger

A simple Compose library to print the reason for recomposition in your `Logcat` window.
Kotlin
469
star
4

klokk

🕒 A kinetic wall clock, built using Compose Desktop
Kotlin
322
star
5

faded

✨ Client did not pay? Add opacity to UI components and decrease it every day until their app completely fades away.
Kotlin
294
star
6

topcorn

A minimalistic movie listing app to browse IMDB's top 250 movies, built to demonstrate MVVM with latest hot-trending Android development tools.
Kotlin
213
star
7

remove-bg

🖼️ Remove photo background with just a tap
Kotlin
208
star
8

compose-animation-playground

A playground for Compose Animations
Kotlin
129
star
9

switch-snake

🐍 Switch Snake implemented using Compose Desktop
Kotlin
127
star
10

source-pilot

🧑‍✈️ A chrome extension to enable IDE like file navigation in GitHub
Kotlin
127
star
11

sim-jacker

Source code for the new SIM card flaw which lets hijack any phone just by sending SMS - Source Code + Demo Video
103
star
12

name-that-color-desktop

Save your brain from the color naming headache
Kotlin
98
star
13

twyper

🔥 Yet another Tinder like swipeable cards, built for Jetpack Compose
Kotlin
95
star
14

compose-chrome-extension-template

🧩 A basic compose chrome extension template
Kotlin
90
star
15

benchart

📊 A web tool to visualise and compare your android benchmark results
Kotlin
86
star
16

compose-desktop-template

💻 A Compose Desktop project template with MVVM, Dagger, Decompose, tests, and more...
Kotlin
79
star
17

gpm

📦 NPM clone for gradle projects
Kotlin
74
star
18

readgen

A simple tool to generate README
Kotlin
66
star
19

tracktor

A GitHub user tracking app, inspired from a GIF. 🕵️ Can be considered as a demo project to showcase MVVM with latest android development tools
Kotlin
60
star
20

compose-android-template

🚀 Android project template with Compose, MVVM, Hilt and Navigation
Kotlin
58
star
21

coin_hive_android_sdk

An android SDK for coinhive.com
Java
58
star
22

gh-meme-maker

Generate memes using GitHub issues
Kotlin
51
star
23

glo

A tool to amplify your movie watching experience 🌟
51
star
24

pencil-ui

WIP : A Multiplatform Compose Theme for your Compose app
Kotlin
46
star
25

leancorn

A simple movie app, built using leanback.
Kotlin
41
star
26

boil

Boil is a CLI partner for adding boiler plate codes to Gradle based projects.
Kotlin
39
star
27

decompose-desktop-example

A simple example of how to use Decomposer for navigation and state keeping in Compose desktop
Kotlin
38
star
28

google-play-api

🏈 Coroutines based Kotlin library to access play store
Java
38
star
29

movie_db

A simple API for IMDB (free and unlimited access - no API key needed)
Java
36
star
30

compose-bird

🐦 A flappy bird clone using Compose Web and radio button
Kotlin
36
star
31

nemo

Nemo is a simple e commerce app powered by google sheets
Kotlin
27
star
32

swipe-search

📺 A sample app to showcase Twyper with GitHub repo search API
Kotlin
26
star
33

gilfoyle

A CLI to interactively remove useless apps from your Android device.
Kotlin
23
star
34

rebugger-plugin

IDE plugin to assist Rebugger
Kotlin
23
star
35

paper-cop

The "Raja Chor Mantri Sipahi" (aka "Kallanum Polisum" 😂) game android-ized.
Kotlin
22
star
36

compose-mario

🎮 An attempt to create Super Mario Bros using Compose for Desktop
Kotlin
22
star
37

phokuzed

Kotlin
21
star
38

abcd

Anybody Can Draw. 🖌️
Kotlin
21
star
39

cyclone

Write JVM apps Android way
Kotlin
20
star
40

super-github

Enhance your GitHub experience 🚀
Kotlin
19
star
41

ccm-analyzer

A CLI companion to analyse and compare Compose Compiler Metrics (CCM)
JavaScript
18
star
42

neymer

Sometimes you'll need a stylish and unique project name without compromising its meaning 😋
18
star
43

show-todo

A simple utility to find your TODOs while working in a team
Kotlin
17
star
44

to-dot-lottie

A CLI tool to bulk convert all .json lottie files to .lottie format
Kotlin
17
star
45

jaba

A simple CLI program to convert your android project's structure.
Kotlin
16
star
46

WhatsApp-Status-Browser

A simple android application to save your friends' WhatsApp status to your gallery
Java
16
star
47

GPix

GPix - An unofficial Google Images API - (FREE AND UNLIMITED ACCESS :))
Java
14
star
48

ugh

Commit messages beautified 💖
Kotlin
14
star
49

reky

⏺ A simple android app to browse your phone call recordings
Kotlin
12
star
50

git-do-not-ignore

A web app to generate .gitignore rule to NOT to ignore a file
Kotlin
11
star
51

notes

A sample app to demonstrate https://github.com/theapache64/retrosheet library
Kotlin
11
star
52

top250

The IMDB top 250 movies in JSON 💻. Updates every 6th hour, 24/7. 😎
Kotlin
10
star
53

compose-web-template

Kotlin
9
star
54

measure

9
star
55

SoundCloud-Downloader

An android application to download tracks/playlists from SoundCloud (UNOFFICIAL , NO ADS and 100% FREE)
Java
8
star
56

send

**QUICK** file transfer using your console
TypeScript
7
star
57

compose-wasm-template

Kotlin
7
star
58

GJack

GJack or Google Hijack is a google sheet phishing tool
Java
6
star
59

avgizer

A web tool to calculate average from given bulk text data
Kotlin
5
star
60

compose-desktop-game-template

🎮 A basic game template for Compose for Desktop
Kotlin
5
star
61

vysor-pro-hack

Vysor pro hack script for 1.9.3_0
Shell
5
star
62

raven

A simple wallpaper app powered by Retrosheet : https://github.com/theapache64/retrosheet
Kotlin
5
star
63

super-google

Enhance your Google experience
Kotlin
4
star
64

organizer

A simple tool to organize your files.
Kotlin
4
star
65

ets

Employee Tracking System is an android project developed to track android devices (under employee-company strategy)
Java
4
star
66

name-that-color

A library to name hex color codes
Kotlin
3
star
67

multi-module-navigation-sample

Kotlin
3
star
68

sms-syncer

Sync all your SMS with your email, real-time.
Kotlin
3
star
69

ambient-IDE

Kotlin
3
star
70

Xrob

A spy application, designed for android.
Java
3
star
71

layzee

Generates beautiful work report from your git commit messages
TypeScript
2
star
72

android-benchmark

Kotlin
2
star
73

url-sherlock

A simple app to reveal URL. Inspired from https://revealurl.xyz/
Kotlin
2
star
74

mufy

A CLI tool to generate gifs from your favorite movie
Kotlin
2
star
75

r8-full-mode-issue-repro

Kotlin
2
star
76

FontAwesomeIconView

FontAwesomeIconView is an Android widget that can be used to show FontAwesomeIcons in your Android application.
Java
2
star
77

auto-motion2

🤖 A CLI to automate your video editing process
Kotlin
2
star
78

modular-navigation

Kotlin
2
star
79

emojipedia-api

An unofficial REST API for emojipedia.org
Kotlin
2
star
80

show-todo-native

Kotlin
2
star
81

livedata_transformation_example

A simple app to show LiveData Transformation, built using ( MVVM + Dagger2 + Retrofit + RxJava + DataBinding )
Java
2
star
82

qpool

An android library to create a questionnaire/feedback application
Kotlin
2
star
83

bugmailer

[DEPRECATED] An android library to send bug report via email
Kotlin
2
star
84

Whistle-Cam

An Android Camera that can capture image using Whistle
Java
2
star
85

twinkill

A simple library, a collection of utlity classes wrapped around JetPack components
Kotlin
1
star
86

stats

A simple file analysis tool for your project
Kotlin
1
star
87

blum

A simple java program to extract package name from an android project directory
Java
1
star
88

WordBird

WordBird is a non-official Android Application of wordhippo.com
Java
1
star
89

green-text

1
star
90

who-wrote

A simple tool to get author statistics from file created signature
Kotlin
1
star
91

theapache64

1
star
92

youtube-rabbit-hole

Kotlin
1
star
93

Log

iOS alternative for Android's Log class
Swift
1
star
94

pewdiepie-vs-tseries

A simple API to get subscriber count of pewdiepie and tseries.
Java
1
star
95

pray-cli

A CLI to get pray timings.
Kotlin
1
star
96

mvpize

A simple command line utility to create MVP components from an activity
Java
1
star
97

quick-emoji

Kotlin
1
star
98

cd-distributable-test

Kotlin
1
star
99

perf-boy

[WIP] A tool to analyse method trace files
Kotlin
1
star
100

material_colors

Android material color palettes
Java
1
star