API dari Google Sheet Spread Sheet Pemrograman Mobile
API dari Google Sheet (Spread. Sheet). Pemrograman Mobile 2
Kelompok 1 Syamsul falah 16. 11. 0029 Muhammad Aris nur Aziz 16. 11. 0046 Linatun Masrohah 16. 11. 0055 Zaenur. Rochman 16. 11. 0068 Yahya Dani Lisharyanto 16. 11. 0070 Muhammad Ali Hasani 16. 11. 0071 Muhammad Yunus 16. 11. 0076 Sofyan Fathur Rohim 16. 11. 0082 Hamid Ashari 16. 11. 0086 Asep Tri Wibowo 16. 11. 0091 Firmansah Putra 16. 11. 0093 2
Google Spread Sheet 3
“ Google sheet adalah satu komponen dalam aplikasi google cloud. Jika kita memiliki akun gmail kita bisa membuat dan berbagi sebuah spreadsheet dengan siapapun termasuk dengan mereka yang tidak memiliki akun gmail. Google Sheet secara komprehensif menawarkan sekumpulan fitur dan fungsi standar spreadsheet seperti dalam spreadsheet application lainya yaitu Microsoft Excel. Selain itu juga terdapat dukungan terbaru yang serbaguna yaitu fungsi QUERY dan REGEX. 4
Kelebihan dari Google Spread Sheet • Multi platform (karena bisa berjalan via browser, bisa digunakan untuk berbagai operating system baik Windows, Linux ataupun Mac OS) • Multi Device (Tidak hanya bisa digunakan untuk komputer / laptop. Telah tersedia untuk versi smartphone juga). • Otomatis tersinkronasi apabila kita melakukan pengeditan dalam satu device. • Tersedia berbagai macam template siap pakai untuk mempermudah pekerjaan kita. • Dapat membuka berkas office lainnya, dapat pula di eksport ke pdf, atau berkas. xls milik Microsoft Excell. • Bisa digunakan secara bebas (free), syaratnya adalah akun gmail yang dapat dibuat secara gratis. Satu email berbagai layanan. 5
Kekurangan dari Google Spread Sheet • Tidak direkomendasikan untuk daerah/kondisi yang sulit internet • Tidak semua kemudahan dalam Microsoft Office Excell tersedia, meskipun demikian fitur-fitur yang ditawarkan sudah sangat powerfull dan sangat layak untuk digunakan. 6
Google App Script 7
“ Google App Script adalah bahasa javascript cloud scripting yang menyediakan kemudahan otomasi tugas untuk seluruh produk google dan layanan pihak ketiga. 8
Google App Script ▷ Di dalam google sheet juga disediakan bahasa pemrograman yang disebut GAS (Google App Script). Kode GAS akan dieksekusi secara remote di dalam google cloud. ▷ Dengan GAS kita bisa melakukan : 1. Menulis UDF (user-defined function) untuk google sheet 2. Membuat aplikasi macro 3. Mengembangkan spreadsheet-based application 4. Integrasi dengan Products & Service Google Lainya 5. Mengembangkan Graphical User Interface (GUI) yang berjalan sebagai Web Application 6. Interaksi dengan cloud-based relational database melalui Google JDBC Service 9
Software Requirement Modern cloud-based application seperti google sheet akan mereduksi sulitnya para pemula dalam mengakses aplikasi. Sebelumnya kita memerlukan sistem operasi tertentu (proprietary) dan membutuhkan software yang harganya mahal untuk memulai belajar. Sekarang masalah tersebut tidak lagi menjadi penghalang, siapapun bisa belajar melalui modern browser namun anda membutuhkan koneksi internet dan akun gmail. 10
MEMBUAT SPREAD SHEET GOOGLE SPREAD SHEET 11
1. buka link https: //www. google. com/sheets/about/ sebelumya pastikan anda telah terdaftar di akun gmail/akun google Tampilan awal Googe Spreadsheet 12
2. Pilih Buka Google Spreadsheet maka akan muncul tampilan seperti berikut 13
3. Pilih Blank untuk membuat Spreadsheet baru Berikan nama pada Untitled Spreadsheet dan berikan nama juga untuk sheet 1, untuk memudahkan kita dalam pemanggilan spreadsheet nantinya 14
4. Setelah itu kita buka Google Apps Script yang digunakan sebagai Web Service kita untuk mengisi maupun mengedit data yang ada pada Spreadsheet tadi yang baru dibuat. buka https: //www. google. com/script/start/ sebelumya pastikan anda telah terdaftar di akun gmail/akun google Tampilan awal Googe Apps Script 15
5. Pilih Start Scripting untuk membuat Script baru Buat Script baru dengan pilih New Script dan berikan nama, contohnya perpustakaan 16
6. Setelah itu tambahkan function yang akan kita gunakan untuk operasi data pada Spreadsheet yaitu function do. Post dan do. Get 17
7. Tambahkan function untuk insert data dan update data 18
8. Tambahkan function untuk get data dan get objek data 19
9. Setelah itu kita publish supaya menjadi web service dengan cara sbb Pilih Update 20
10. Kemudian akan muncul popup yang disitu terdapat link yang dapat kita gunakan sebagai jalan komunikasi aplikasi android dengan Spreadsheet Google 11. Copy link tersebut dan coba jalankan menggunakan postman sebelum itu coba isi data terlebih dahulu pada Spreadsheet Google yang sudah dibuat 21
Hasil Dari Postman 22
PROJEK MENGOLAH DATA MENGGUNAKAN SPREADSHEET SEDERHANA 23
Membuat contoh aplikasi perpustakaan sederhana menggunakan Spreadsheet Google dan Retrofit ▷Buat New Project Pada Android Studio ▷Pilih empty activity 24
Menambah dependencies untuk retrofit , gson dan menambah permission ▷ Project->app->build. gradle ▷ Kemudian tambahkan permission pada Android Manifest 25
Buat layout ▷Activity_main. xml Tampilan awal aplikasi 26
▷list_book. xml Untuk menampilkan buku dalam bentuk list menggunakan recyclerview 27
▷item_book. xml Untuk menampilkan detail buku menggunakan Card. View 28
▷add_buku. xml Tampilan yang nantinya digunakan untuk menginputkan data buku 29
Membuat API Client dan interface ▷ Buat kelas baru dengan nama Api. Client ▷ Buat Interface baru dengan nama Api. Interface 30
Kelas Api. Client. java ▷ Berfungsi untuk menginisialisasikan reftrofit yang nantinya akan digunakan untuk mengolah data json. ▷ Base Url diisi dengan url Google Spreadsheet punya temen 2 yang sudah dipublish 31
Interface Api. Interface. java ▷ Berfungsi sebagai interface yang menyimpan nama method yang akan digunakan untuk mengolah data seperti input data maupun lihat data 32
Membuat kelas Model ▷ Buat kelas baru dengan nama Model. Buku ▷ Buat kelas baru dengan nama Get. Buku 33
Kelas Model. Buku. java ▷ Berfungsi untuk menampung data dari json yang didapat dan data dari operasi user 34
Kelas Get. Buku. java ▷ Berfungsi untuk menampung data dari json yang didapat khusunya json dalam bentuk array 35
Membuat kelas Adapter ▷ Buat kelas baru dengan nama Adapter. Buku ▷ Buat kelas baru dengan nama Adapter. Tab 36
Kelas Adapter. Buku. java ▷ Berfungsi sebagai kelas adapter yang digunakan untuk menampilkan data pada Recycler. View 37
Kelas Adapter. Tab. java ▷ Berfungsi sebagai kelas adapter yang digunakan untuk pada tab layout yang terdapat di main activity 38
Membuat Kelas Fragment ▷ Buat kelas baru dengan nama Fragment. Book ▷ Buat kelas baru dengan nama add_buku 39
Kelas Fragment. Book. java ▷ Berfungsi sebagai kelas yang akan menampilkan data response dari json yang nantinya akan dikirimkan ke adapter buku dan ditampilkan di recyclerview 40
Kelas add_buku. java ▷ Berfungsi sebagai kelas yang digunakan untuk menambagkan data buku berdasarkan inputan yang ada 41
Kelas Main. Activity. java ▷ Kemudian pada Main. Activity kita tinggal memanggil 2 Kelas Fragment yang tadi dibuat 42
Output Jika digeser ke kanan maka akan muncul tampilan menambahkan data 43
▷ Kemudian dicoba masukkan data buku baru Isikan data pada tampilan tambah buku Tampilan Data kemudian di klik tambah dan geser ke kiri untuk melihat data yang baru diinputkan 44
Inilah tampilan Spreadsheet Google yang digunakan pada aplikasi ini. 45
REFERENSI • https: //chromplex. com/membuat-crud-api-menggunakan-google-sheets/ • https: //www. codepolitan. com/rest-api-client-sederhana-dengan-retrofit-pada-androidstudio-58986 d 62 c 46 ae • https: //medium. com/@sulistiyanto/tutorial-android-insert-data-ke-mysql-dan-php-dengan -retrofit-crud-online-bagian-i-3 b 3 c 48 adff 39 • https: //medium. com/@gungunfebrianza/apa-itu-google-sheet-google-app-scriptbe 640875 f 105 • http: //edi. sutanto. web. id/2017/09/kelebihan-dan-kekurangan-google-spreadsheet. html 46
Thanks! Any questions?
- Slides: 47