0

I wanted to print my Google spreadsheet with a button click and I tried different codes and finally tried the following code. But I am getting the following error.

TypeError: SpreadsheetApp.setPrintSettings is not a function

Would someone be able to help me resolve this?

function setPrintSettings() {
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var printSettings = {
    orientation: 'landscape',
    paperSize: 'letter',
    scale: 100,
  };

  SpreadsheetApp.setPrintSettings(printSettings);
}
Codist
  • 737
  • 8
  • 23
  • May I ask how you get the code for this question? – Rubén Aug 21 '23 at 23:15
  • What do you mean? – Codist Aug 22 '23 at 07:50
  • It looks like the code was written by someone who has no idea what `SpreadsheetApp` is and how to use the Google Apps Script IDE or a tool like ChatGPT. It might look like a generative AI *hallucination*. If a human wrote this code, they might benefit from learning about Google Apps Script; if this was written by a GenAI tool, you might be interested in learning more about them and [genai.se] might help with that. – Rubén Aug 22 '23 at 17:05

0 Answers0