How to create a Data Entry form in Google Sheets

When it comes to mass data entry works, it is essential to use data entry forms to improve accuracy and speed. This tutorial will show you how you can create a data entry form in Google Sheet. With Google Sheets, it has many advantages over data entry forms like MS Access installed on your local computer.

The default form option comes with the Google sheet (Google Form) is not suitable for mass data entry works. Instead of that, you can use Google Apps-Scripts to build a data entry form in Google Sheet or to build web apps.

Aliexpress - CPS - World Wide

In this post, I will show you how to create a data entry form in Google Sheet itself to use for mass data entry works.

In the previous post, I explained, “How to Create a Dependent Drop-Down List in Google Sheet“. Here I am going to use those two fields as part of the data entry form.

Creating the form interface

You can simply create the form interface by taking the cells as input fields. The following form includes six input fields namely “Region”, “Country”, “Population” “GDP”, “Area”, and “Literacy” in D4, D6, D10, D12, G10, and G12 cells respectively.

Form
Figure 01: Data entry form

You can protect the entire sheet except the input fields to prevent users from editing the other cells.

The “Save” button

Here I am using an image as the save button. (Later I will assign apps script function to this image to copy the data into another sheet once you clicked it).

To create this image go to, Insert > Drawing and then draw a rounded rectangle using the Rounded Rectangle shape tool. Then add your text and add colors using color tools.

Apps script to copy data from the form to another sheet

Once you click the save button, the data in the input field should copy to another sheet. This task can be achieved through Google Apps Scripts.

To access Script Editor, go to Tools > Script editor. Give a name to your project. Then copy the following script to the script editor and save.

Rename your sheet which includes the form as “Form” and another sheet as “Data”. We are going to copy the data in the Form to this “Data” sheet.

function submitData() {
  var ss        = SpreadsheetApp.getActiveSpreadsheet();
  var formSS    = ss.getSheetByName("Form"); //Form Sheet
  var datasheet = ss.getSheetByName("Data"); //Data Sheet
  
  //Input Values
  var values = [[formSS.getRange("D4").getValue(),
                 formSS.getRange("D6").getValue(),
                 formSS.getRange("D10").getValue(),
                 formSS.getRange("G10").getValue(),
                 formSS.getRange("D12").getValue(),
                 formSS.getRange("G12").getValue()]];
  
  datasheet.getRange(datasheet.getLastRow()+1, 1, 1, 6).setValues(values);
}

Assign Apps Script to save button

Now you can assign the function submitData() to the save button (actually the image). To do that, click on the image and then click the menu icon in the top right corner of the image. Then select the “Assign script” option. In the text box type your function name, submitData and click OK.

Now you can fill the form and copy the data to the “Data” sheet by clicking the save button.

Make a copy of the above Google Sheet

Go to Tools > Script editor to view the code
1 l8Um43Fq5cVcyAIMGXDpkQ 2

What next?

The above code does not clear the input fields after submitting the data. You can use clear() function to clear the required fields after submitting the data to the “Data” sheet.

The data validation part is another essential part in data entry forms. You can check the values of the field before they copying to the “Data” sheet using conditional statements. Then you can provide meaningful error messages to the user using Browser.msgBox("Error message!")function.

Even though this method is better for mass data entry works than Google Forms, there are a number of other issues. You have to grant edit permission to the user to the “Data” in order to copy the form data to it. Therefore some errors can happen during the data entry. The form is also not much user-friendly.

In order to overcome those issues, you can build your own web app using Google Apps Script HTML Service.

If you wish to create a more advanced data entry form for Google Sheets you may read our other tutorial on web apps.

Wrapping Up

In this tutorial, I showed you the easiest methods that you can use to create a data entry form in Google Sheet. However, as mentioned above, there are some disadvantages to using this method. Some of these can be overcome by creating Sidebar & Modal Dialog forms in Google Sheets.

5 1 vote
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

46 Comments
Inline Feedbacks
View all comments
j m

Here’s what i added to clear after clicking the submit button. I didn’t study coding and just did it by trial and error.

function submitData() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var formSS = ss.getSheetByName(“Form”); //Form Sheet
var datasheet = ss.getSheetByName(“Data”); //Data Sheet

//Input Values
var values = [[formSS.getRange(“B6”).getValue(),
formSS.getRange(“B7”).getValue(),
formSS.getRange(“B8”).getValue(),
formSS.getRange(“B9”).getValue(),
formSS.getRange(“B10”).getValue(),
formSS.getRange(“B11”).getValue(),
formSS.getRange(“B12”).getValue()]];

datasheet.getRange(datasheet.getLastRow()+1, 1, 1, 7).setValues(values);

formSS.getRange(“B7”).clear()
formSS.getRange(“B8”).clear()
formSS.getRange(“B9”).clear()
formSS.getRange(“B10”).clear()
formSS.getRange(“B11”).clear()
formSS.getRange(“B12”).clear()
}

Adam B

Great. Very helpful – simply and in point. Thanks for this article.

Adam Taylor

Hi! this is very helpful, is there a way I can get it so that the data is added to next available row rather than the last row, as it is sending the data to row 500 etc at the bottom of my spreadsheet.

popstaxx

thank you worked well. i want to use this form to update data already submitted in the datasheet. for eg updating delivery dates . can someone please help me

Admin
Iis Kusaeri

can we create login form using g sheets?

nathalie roodenburg

Thank you for this post. Is it also possible to use this as a search data library from a google sheet. I have a reference Data library sheet with a lot of data and I’m looking for a easy way to find only the relevant data in the sheet with a kind of form (checklist)

Jake

This script has worked like a charm but I was wondering if there was a way to instead have it submit a cell value, maybe submit a formula that will calculate on the data sheet. Example, I have:
formSS.getRange(“C3”).getValue(),
C3 has a formula in the cell and I would like to transfer that formula over rather than having it submit the cells value. Any help would be appreiciated.

Dey

Thank you! this is very helpful! do you have script for Search Function? I tried to make a script for Search function but it’s not properly working. i searched by last name and first name. I cannot use last name only because i have entries with the same last name.

Jopel Tomimbo

How to clear the input bar after the data is submitted??

Admin

You can use clear() function for this.
See the modified code below.

function submitData() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var formSS = ss.getSheetByName("Form"); //Form Sheet
var datasheet = ss.getSheetByName("Data"); //Data Sheet

//Input Values
var values = [[formSS.getRange("D4").getValue(),
formSS.getRange("D6").getValue(),
formSS.getRange("D10").getValue(),
formSS.getRange("G10").getValue(),
formSS.getRange("D12").getValue(),
formSS.getRange("G12").getValue()]];

datasheet.getRange(datasheet.getLastRow()+1, 1, 1, 6).setValues(values);

//Clear the fields after submit
formSS.getRange("D4").clear();
formSS.getRange("D6").clear();
formSS.getRange("D10").clear();
formSS.getRange("G10").clear();
formSS.getRange("D12").clear();
formSS.getRange("G12").clear();
}

Charlie

Used this code and it has worked perfectly,

i wanted to know if there is a way to make it skip columns and only populate some?

for example, populate the first 3 columns with data, skip 1, and then populate another 2 columns?

Cheers

Admin

Hi Charlie,
There are multiple ways to do that. It depends on your requirement.
Assuming that you are going to insert some formula for the skipped column, I suggest the following.

function submitData() {
  var ss        = SpreadsheetApp.getActiveSpreadsheet();
  var formSS    = ss.getSheetByName("Form"); //Form Sheet
  var datasheet = ss.getSheetByName("Data"); //Data Sheet
  
  //Input Values
  var values1 = [[formSS.getRange("D4").getValue(),
                 formSS.getRange("D6").getValue(),
                 formSS.getRange("D10").getValue()]];


  var values2 = [[formSS.getRange("G10").getValue(),
                 formSS.getRange("D12").getValue(),
                 formSS.getRange("G12").getValue()]];


  var lastRow = datasheet.getLastRow();


  datasheet.getRange(lastRow+1,1,1,3).setValues(values1);
  datasheet.getRange(lastRow+1,5,1,3).setValues(values2);
}
Charlie

Brilliant, Thanks so much.

Charlie

Hello, ive just enabled this in my sheets and it works great at getting the data across. however the issue i am having is that it is still skipping the rows as i have formulas in the cells it is skipping.
is there a way to get over this?

kind regards

Charlie

Hello,

Looking at a separate question now which I’m not sure is possible or not.

I have built a similar form to that of the example.

Is there a way to have a separate form to edit the data once it has been inputted?

for example, you have a separate form and load up current information for Bangladesh, however you now want to change the area to 145000.

is there a way to make it update the existing entry?

cheers

Tome

Hi,
is there a possibility that if a field gets populated by the user a second dependent field gets automatically populated by the app?

Hey, wait!

Before you go, Subscribe to Blog via Email

shares