Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have a working solution, that uses <code>deleteRows()</code>. I'm not sure why that didn't work for you, it would be interesting to see your code. </p> <p>The new Forms product (February 2013) is quite different than the legacy forms - <em>this solution will work on legacy forms only</em>.</p> <p>Anyway, here's what I have, with before &amp; after screenshots. The <code>tidy()</code> function can be called by passing in the number of rows to be removed, or you can call it from a menu as demonstrated here. A more complete version of this script is <a href="https://gist.github.com/mogsdad/5014758" rel="nofollow noreferrer">available as a gist</a>.</p> <pre><code>/** * Standard onOpen provided in script template. */ function onOpen() { var sheet = SpreadsheetApp.getActiveSpreadsheet(); var entries = [{name : "Read Data",functionName : "readRows"}, {name : "Tidy Form Responses", functionName : "tidy"}]; sheet.addMenu("Script Center Menu", entries); }; /** * Prompt user for the number of form response rows to remove, then delete them. * Assumes that the form responses are in the active sheet, that there is one * row of 'headers' followed by responses (in row 2). * * @param {number} thisMany (Optional) The number of rows to remove. If not * specified, user will be prompted for input. */ function tidy(thisMany) { if (tidy.arguments.length == 0) { thisMany = Browser.inputBox("How many responses should be tidied?"); } var sheet = SpreadsheetApp.getActiveSheet(); sheet.deleteRows(2, thisMany); } </code></pre> <h2>Before</h2> <p><img src="https://i.stack.imgur.com/8VFep.png" alt="Spreadsheet with form responses and custom menu"></p> <h2>During</h2> <p><img src="https://i.stack.imgur.com/1qruk.png" alt="Script operation, inputBox"></p> <h2>After</h2> <p><img src="https://i.stack.imgur.com/0ilXZ.png" alt="Spreadsheet with 2 fewer form responses"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload