0

Good day all,

I have created macro-enabled Excel file that unfortunately will be not usable by the company I work at since they decided to use Google sheets.In this Excel workbook,there is one data entry form which looks like that: Data entry form . The data from this form gets written under specific columns in another Excel sheet. In Excel I could use VBA to create the functionality of the 'Submit' button which sends the data to the respective sheet,however,in Google Sheets JavaScript is supported and not VBA.So far, this is the JavaScript function I have managed to create:

function inputData() {
  const ss=SpreadsheetApp.getActiveSpreadsheet()
  const form=ss.getSheetByName("Input")
  const prodlog=ss.getSheetByName("Product log")
  const fieldRange=["B1:D1","B3:D3","B5:D5","B7:C7","B9:D9","B11:D11","B13:C13"]
  const fieldValues=fieldRange.map(f=>form.getRange(f).getValue())

  //console.log(fieldValues)

  prodlog.appendRow(fieldValues)

}

However, the appendRow () function doesn't allow specifying where exactly the data should be appended.Any ideas how this can be achieved?Thank you in advance for your suggestions.

  • Are the elements of fieldRange merged cells? – Cooper Jun 23 '22 at 18:07
  • Where do you wish to append data? – Cooper Jun 23 '22 at 18:10
  • Hi Cooper,thanks for your reply.No,they are not merged cells,and I need the appended data on separate sheet but under specific columns in this sheet.AppendRows() doesn't allow this specification – Gabriela Torlakova Jun 23 '22 at 19:49
  • See linked duplicate above. – TheMaster Jun 23 '22 at 20:04
  • appendRow simply appends an array to the bottom of a sheet. The columns can be mapped in any way that one wishes. But my question is still where do you wish that data to be placed. Also your form has seven pieces of data and there are seven ranges in fieldRange yet each range has more than one cell so how many pieces of data are you transferred. Your question is not explained well. – Cooper Jun 23 '22 at 20:17
  • Only seven pieces of data are transferred. – Gabriela Torlakova Jun 24 '22 at 09:22

0 Answers0