title: Method to return data from different ranges using the same function
body: <p>I am looking for a method to use the same function from a script to return multiple different data ranges for output to another sheet within Google Sheets.</p>
  
  <p>This is my first attempt at using Google scripts for any automation, so bear with me. This project is designed as a system to place a product order from an inventory sheet. The inventory sheet contains product information and part numbers which are used in the ordering process. I created a script with a button trigger which copies the data from one sheet to an order sheet, which can later be printed off. This allows another staff member to have all information needed to place the order. The problem is that I am only able to copy one product to the order sheet with each script, is there another way to do this?</p>
  
  <p><strong>Product Inventory (copied from)</strong></p>
  
  <p><a href="https://i.stack.imgur.com/KP5Dj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KP5Dj.jpg" alt="enter image description here"></a></p>
  
  <p><strong>Order Form (copied to)</strong></p>
  
  <p><a href="https://i.stack.imgur.com/ydOzj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ydOzj.jpg" alt="enter image description here"></a></p>
  
  <p>The first image is where the data would be copied from and it would be added to the sheet shown in the second. I want to be able to use another button running the same script as the first to copy the second row of information to the order sheet. (The quantity row is filled in by the user and will also get copied to the order)</p>
  
  <p>This is the button script:</p>
  
  <pre><code>
    //Copies Part Info
    var ss = SpreadsheetApp.getActiveSpreadsheet()
    var sheet = SpreadsheetApp.setActiveSheet(ss.getSheets()[1])// Sets the active sheet to the complete inventory
    var range = sheet.getRange('A2:D2')// This is the one that I am able to copy
    var values = range.getValues()// Stores the product info
    return values;
    //Pastes Info to Order
    var activeSheet = SpreadsheetApp.setActiveSheet(ss.getSheets()[0])// Sets the order sheet as active
    var lastRow = activeSheet.getLastRow()//The next few lines find the next empty row on the sheet to paste the next data into
    var nextRow = parseInt(lastRow)+1
    var reqRange = activeSheet.getRange("A1:D100")
    var inputCell = reqRange.getCell(nextRow,1)
    var addData = inputCell.setValue(values)//Pastes the part info into the availabe cell
  </code></pre>
  
  <p>Is there a way to use the same script on multiple products or will a copy have to be made for each?</p>