0

I am making a program that retrieves Google forms responses uses selenium and beautiful soup to then fill out another form with those same answers and after I am done with that I want to delete all responses but I can't figure out how to delete a response even after reading the docs.

I read the docs and tried random syntax that seemed like it would make sense and checked if anyone else has asked the same question

1 Answers1

0

Unfortunately, in the current stage, all responses cannot be deleted by Google Forms API while the responses can be retrieved. Google Forms API is growing now. So, this might be able to be achieved by the future update.

But, as a current workaround, in this answer, I would like to propose using Google Apps Script. Fortunately, when Google Apps Script is used, all responses to Google Forms can be deleted by a simple script.

The sample script is as follows. But, in this case, you are required to have permission for editing Google Forms. Please be careful about this.

function sample() {
  FormApp.openById("###Google Form ID###").deleteAllResponses();
}

or, if you can use the container-bound script of Google Forms, the following script can be also used.

function sample() {
  FormApp.getActiveForm().deleteAllResponses();
}

For example, when you want to run this script with Python script, I think that Web Apps can be used. About the sample flow for deploying Web Apps and requesting Web Apps by Python script, this thread might be useful. Convert Google Sheet to PDF and store in same Google Drive folder as sheet

Reference:

  • deleteAllResponses()

    Deletes all submitted responses from the form's response store. This method does not delete copies of responses stored in an external response destination (like a spreadsheet), but does clear the form's summary view.

    Beware: this method is irreversible.

Tanaike
  • 181,128
  • 11
  • 97
  • 165