V
V
Vladimir Zuev2020-06-23 10:42:46
Google Apps Script
Vladimir Zuev, 2020-06-23 10:42:46

How to correctly insert an array into a table row?

How to correctly insert an array into a string?
Wrote this code

function AppendRow() {
  let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data')[0];
  var array = [
    'Петя',
    44444,
    'Петя',
    44444,
    'Петя',
    44444,
    44444,
    44444,
    44444,
    'Петя',
    'Петя',
    44444,
    'Петя',
    'Петя',
  ];
  sheet.appendRow(array);
  sheet.appendRow(['Frodo', 'Baggins', 'Hobbit', 'The Shire', 33]);
}

Swears writes
TypeError: Cannot read property 'appendRow' of undefined

How to correctly insert an array into a string?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2020-06-23
@vladd56

Must be

const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question