VOOZH about

URL: https://www.geeksforgeeks.org/android/how-to-upload-excel-sheet-data-to-firebase-realtime-database-in-android/

⇱ How to Upload Excel/Google Sheet Data to Firebase Realtime Database in Android? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Upload Excel/Google Sheet Data to Firebase Realtime Database in Android?

Last Updated : 23 Jul, 2025

Firebase Realtime Database is the backend service which is provided by Google for handling backend tasks for your Android apps, IOS apps as well as your websites. It provides so many services such as storage, database, and many more. The feature for which Firebase is famous for its Firebase Realtime Database. By using Firebase Realtime Database in your app you can give live data updates to your users without actually refreshing your app. In this article, we will be uploading Google/Excel Sheet Data into the firebase real-time database. This can be useful when you are creating a quiz app where you have to upload a lot of question. In that case, you can upload your data using an excel sheet.

What we are going to build in this article?  

We will be building a simple application in which we will be uploading data into the firebase real-time database using Google/Excel Sheet. Firstly we will be selecting an excel file and then it will be uploaded to firebase by taking the total number of rows and columns and then a random id will be generated in which row-wise data will be stored.

Note that we are going to implement this project using Java/Kotlin language.


Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio.

Step 2: Working with the AndroidManifest.xml file

For adding data to Firebase we should have to give permissions for accessing the internet. For adding these permissions navigate to the app > manifests > AndroidManifest.xml and Inside that file add the below permissions to it.  

<uses-permission android:name="android.permission.INTERNET" />

Step 3: Working with the build.gradle(app) file

Add these implementations into it

dependencies {
...
implementation("com.github.bumptech.glide:glide:4.16.0")
}

To add Firebase Database to your project refer to this article: How to Save Data to the Firebase Realtime Database in Android?

Step 4: Creating a URL for fetching our data from Google Spreadsheet

Create a simple Google Spreadsheet which is shown below. Make sure to use the same headers as shown in the below file. 

👁 Layout_2

After you have created our excel file. Now we have to publish this excel file to use it inside our app. For publishing it.  

👁 Publish_on_Web


After this a dialog box will pop up select type of web share as CSV and then click on publish.

👁 Publish_on_Web2


 Now we have created a URL in which we will be getting the data in the CSV format. Also, a sharable link will appear copy it.

Note: this is the link which is used in the application created below.

Step 5: Working with the activity_main.xml file

Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file. Now, Create a layout file for each item in recyclerview. Navigate to the app > res > layout > Right-click on it > New > layout resource file and give the file name as items and add below code to it.


Design UI:

👁 upload-sheet-data-home


Step 6: Creating a Modal class for storing our data   

For storing our data we have to create a new java class. For creating a new java class, Navigate to the app > java/kotlin > your app's package name > Right-click on it > New > Java/Kotlin class and name it as UserModal and add the below code to it. 


Step 7: Creating an Adapter class for setting data to our RecyclerView item  

For creating a new Adapter class. Navigate to the app > Java/Kotlin > your app's package name > Right-click on it > New > Java/Kotlin class and name it as UserRVAdapter and add the below code to it. 

Step 9: Creating a SheetRow

SheetRow is a new file created which will help us create new rows in the Application. Navigate to the app > Java/Kotlin > your app's package name > Right-click on it > New > Java/Kotlin class and name it as SheetRow and add the below code to it. 


Step 10: Working with MainActivity file

Go to the MainActivity file and refer to the following code. Below is the code for the MainActivity file. Comments are added inside the code to understand the code in more detail.


Output:


Comment

Explore