Java – how to programmatically create and manage Google forms through the Google document list API

We have very specific needs We want to create a general (Java - based) registration system for event organizers Therefore, each event organizer can define a custom form on our application, and then we collect data for that specific event from that user

Now the input field can be changed from event to event, so I want to use some cloud @ r out of the box_ 301_ 2422 @ case An obvious thing that comes to mind is using Google forms Therefore, for each activity, if we can programmatically create a Google form and obtain the following two contents: 1) embed the link of the form, 2) access the corresponding data and keep the Google Spreadsheet

We can use embedded links to display the registration form to users on the activity page We can access Google Spreadsheet to access the data users fill out the registration form

But when I search it, I can't clearly achieve this goal There are some Google documents list APIs through which you can create Google Documents programmatically, but I can't figure out how to meet our needs through this API

It would be very helpful if someone could guide us in this regard Or suggest we any backup cloud @ R_ 301_ 2422 @ case

Update: Google doesn't seem to offer an API at all for forms linked to spreadsheets http://goo.gl/ia8rk If we are lucky, they may be added in a future version So can any other cloud based API easily solve this problem?

Solution

If I understand correctly, you have Google forms and want a way to automatically generate forms The generated form should link its response back to the spreadsheet Is that right?

I don't know how to do this in Java (I don't think so if there is an API available), but it can be easily done through Google scripts This is built in the script editor of Google Spreadsheet

Here is an example:

function onopen() {
  // read the docs to add to the toolbar
}

function getColumnHeaders() {
  // this grabs the headers of your sheet
  var headers = SpreadsheetApp
    .getActiveSheet()
    .getRange(1,1,SpreadsheetApp.getActiveSheet().getLastColumn())
    .getValues()[0];

  // this will appear in your root directory
  var newForm = FormApp.create('NEW FORM NAME');
  newForm.setDestination(FormApp.DestinationType.SPREADSHEET,SpreadsheetApp.getActiveSpreadsheet().getId());

  headers.forEach(function(each) {
    newForm.addTextItem().setTitle(each);
  });
}

The documentation can be found here: https://developers.google.com/apps-script/reference/forms/

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>