Google Sheets Insert Row Form

Viewed 3676

I have a running parts order list that several people use. I am trying to have the top row be a form so the user enters Qty, Part #, and Notes and presses Enter. I want it to add a row to the top of the sheet below the headers and maintain the table structure so we can filter.

2 Answers

Instead of using the top row, go to Tools then create form. This will make it easier to input stuff. Also no one can muck up your sheet.

Also I would read what you can post here :) I like to be friendly so I thought I'd put an answer

You should read about Google Apps Script. GAS is the easiest way to read/write data in Google Spreadsheet/Docs/Forms.

So as far as I understand from your question, you need to insert a row in Google Spreadsheet below the header directly as soon as the forms.

Step 1: Open the spreadsheet using openById(id)

Step 2: Get the worksheet in which you want to save your Google Forms data using getSheetByName(name)

Step 3: Insert row before specified position using insertRowBefore(beforePosition)

So final code should look like this.

  var spreadsheet = SpreadsheetApp.openById("1BZuYFCnN_g9vn5crxbPeYlhUKwH6N3u0uT8LCmm-neM");
  var sheet = spreadsheet.getSheetByName("Nov-2017");
  sheet.insertRowsBefore(2);

The code above will insert only one row below spreadsheet headers. There is an alternative -> insertRowsBefore(beforePosition, howMany) if you want to insert multiple rows at a specified position.

Try this and let me know if you find any difficulties. Hope this is what you're looking for.

Related