Advertisements

Fetch Data from Google Spreadsheet – Hello, This is the 6th Google Apps Script tutorial in which I will show how to fetch data from Google Spreadsheet into Form fields. In the 5th part of Google Apps Scripting How to series, I have shared information about writing data into Google Spreadsheet. In this post, I will show How to Fetch Data from Google Spreadsheet into Google Form Fields.

Read Also:

Fetch Data from Google Spreadsheet File

It is very simple to fetch data from Google Spreadsheet in Google Form Fields. In this tutorial I will show how to fetch particular record like based on primary key just like in any other database. See the Spreadsheet below in which User Id column is used to store unique key value.

Screenshot_4

In the earlier post I have already shown how to create UI Application using Google Apps Scripting. Now you just need to add one more textbox and label which will be used as search box. 

Screenshot_5

Trick to Fetch the data from Google Spreadsheet is very simple, all you need to do is find the required row id. Data in Spreadsheet is stored just like 2D Array. Suppose if the user searches for “a001” user id then it is row 2 of the sheet. And to display the value of corresponding Name in the text box you have to set its value with sheetdata[2][1]. Where [2] means the data is in second row and [1] means value of first column.

Complete Code to Fetch Data from Google SpreadSheet

Code to Fetch Data from Google SpreadSheet

Try this and comment below for when of any problems.

Advertisements
The following two tabs change content below.
Techno@admin is owner and passionate blogger of Technokarak from Delhi, INDIA. He is an Engineer and loves to discover and learn new things on Internet. At Technokarak, he writes articles on Wordpress, SEO, Mobiles, Tablets and other technical stuff.
For Latest Mobile Prices Visit MySmartprice.com