简体   繁体   中英

A fillable table in Google Forms that records data in a specific Google Sheet

I'm trying to create a table with editable cells in a google form that lets people enter their recorded measurements. Then compile that information into a Google Sheet by specified columns.

I have tried the Awesome table but I cannot seem to get the script to work.

Broken Down, I need the Script to be able to:

  • import a table into google forms
  • edit the number of columns and rows
  • allow multiple people to record their measurements individually
  • Compile the recorded data into a sheet by column.

This may be a simple question that I am overthinking. But I am trying to avoid multiple questions on the same form, and think a table would be way easier.

As talked in the comments, since there is no table item in FormApp , this solution consists in sending a Sheet with a predefined table for users to fill. They will press a button and send the data to a master sheet.

CODE

function sendData() {           

  //Gets the sheet is being edited
  var sprsheet = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = sprsheet.getActiveSheet();

  //Gets the data introduced by the user
  var range = sheet.getRange("A2:L2");
  var values = range.getValues();

  //Gets the target sheet
  var mainsprsheet = SpreadsheetApp.openById("main sheet id");
  var targetSheet = mainsprsheet.getActiveSheet();

  //Adds a new row to the target sheet with the collected data
  targetSheet.appendRow(values);

  //Clear the cells (optional)
  range.clearContent();
}

BUTTON

To create the "submit" button to run the function above:

  1. Go to Insert > Drawing
  2. Design your own button
  3. Save and close
  4. Click on the button and then on the 3 dots at the right-top.
  5. Click on "Assign script" and write sendData

You can place the button anywhere and resize it.

NOTES

  • You might want to send copies of this sheet to the different users to avoid sharing of sensitive data.

REFERENCES

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM