Scan QRCode and Save it in Google Sheet using Google App Script

This tutorial explains about storing QR code scanned data in Google Spread Sheet. This is very simple application which uses Zxing Qr code api, Android http client and Goolge App script.

 

Here It consists of 2 Parts,

Google App Script Part (Back End)
Android Part (Front End)

   Download Source Code

 

1.Google App Script Part
Step 1: Create new app script project. Click here to create App Script.

Step 2: Copy and paste the below script which recieves scanned data  and inserts in Google Sheet.

 

Step 3: Change the url of the spread sheet. Make sure sheet is shared .[anyone with the link can view]

Step 4: Go to Publish -> Deploy as web app. A window pop up, here ->Who has access to the app: ->  Anyone,                   even Anonymous

            Publish/Update. Copy the published URL and store it.

 

2. Android Part

Step 1: Create new Android App from Android Studio

Step 2: Go to build.gradle[module: app] and add following dependencies.

note: If you are downloading the source code and modifying. Please make sure build tool version and compileSdk Version in build.gradle[module: dependancyapp] are compatible with your phone. If you are developing from the scratch then no issues, just dependency,

 

Step 3: Let’s add all layout files.

 

activity_main.xml  This adds a button to Scan

Step 4: add the following code to MainActivity.java which scans and calls web service

 

Step 5: Add web App URL from script and pass the parameter as defined in script in above MainActivity.java

 

 

Step 6: Add Internet Permission in manifest file

 Download Source Code