Skip to content

Commit

Permalink
Add some scripts for aggregation (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikukyugamer authored Nov 28, 2022
1 parent f7e96be commit 8e0ebec
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
15 changes: 15 additions & 0 deletions METHODS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 主要メソッド

## セレクトボックス(プルダウンメニュー)を設定する

## セルに色を付ける

## 「固定」の区切り線を入れる

## 「データの入力規則」を設定する

## シートやセルを保護する

## 「テキストの折り返し」を設定する

## 「チェックボックス」を設定する
19 changes: 19 additions & 0 deletions src/getEachSheetId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const getEachSheetId: Function = (): void => {
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
const allSheets = spreadsheet.getSheets()

const eachSheetId: Record<string, any>[] = []
for (let i = 0; i < allSheets.length; i++) {
eachSheetId[allSheets[i].getName()] = allSheets[i].getSheetId()
}

let eachSheetIdForShownText = ''
for (const [key, value] of Object.entries(eachSheetId)) {
// ★
eachSheetIdForShownText += `${key},${value}\n`
}

console.log(eachSheetIdForShownText)
Browser.msgBox(eachSheetIdForShownText)
}
7 changes: 7 additions & 0 deletions src/onOpen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const onOpen: Function = (): void => {
SpreadsheetApp.getActiveSpreadsheet().addMenu('幻水総選挙', [
{ name: 'シート順ソート', functionName: 'sortSheetsByJapanese' },
{ name: 'シートID取得', functionName: 'getEachSheetId' },
])
}
11 changes: 11 additions & 0 deletions src/tryDropdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const tryDropdown: Function = (): void => {
const ss = SpreadsheetApp.getActive()
const sh = ss.getSheetByName('Z_自由シート_01')
const vrg = sh.getRange('A1').clear({ validationsOnly: true })
const dv = SpreadsheetApp.newDataValidation()
.requireValueInList(['foo', 'bar'].sort(), true)
.build()
vrg.setDataValidation(dv)
}
// https://stackoverflow.com/questions/57347606/drop-down-list-from-column-with-comma-separate-data-google-sheets

0 comments on commit 8e0ebec

Please sign in to comment.