Google Apps Script スプレッドシートに新しいシートを挿入するサンプル

環境
Google Chrome  122.0.6261.129(Official Build) (64 ビット)
Windows 11 Pro 64bit

構文
spreadsheet.insertSheet(“シート名", インデックス番号 ,[ {template: テンプレート用のシート} ])
新しいシートを挿入するには、「insertSheet()」を使用します。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function myFunction() {
// スプレッドシート作成
let spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
// 新しいシートを挿入する
spreadsheet.insertSheet('新しいシートテスト');
}
function myFunction() { // スプレッドシート作成 let spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); // 新しいシートを挿入する spreadsheet.insertSheet('新しいシートテスト'); }
function myFunction() {

  // スプレッドシート作成
  let spreadsheet = SpreadsheetApp.getActiveSpreadsheet();

  // 新しいシートを挿入する
  spreadsheet.insertSheet('新しいシートテスト');

}

 

Google Apps Script

Posted by arkgame