2

I create google form and save data when user fill out google form to google sheet. After that I use gspread read data and create csv file. I want to remove all data in google sheet after python create csv file already. I user this code

worksheet = sheet.get_worksheet(0)
worksheet.delete_row(1)

It show this error.

APIError: {'code': 400, 'message': 'Invalid requests[0].deleteDimension: Cannot delete row with form questions. Consider hiding the row instead.', 'status': 'INVALID_ARGUMENT'}

Can I use gspread delete row in google sheet which create by google form ?

user572575
  • 1,009
  • 3
  • 25
  • 45

1 Answers1

2

The problem is that you are trying to delete the top row - the one that contains the headers.

This is not possible, but you can delete all other rows.

Note: Your first form response will be in the second row - since the first one contains the headers.

ziganotschka
  • 25,866
  • 2
  • 16
  • 33