这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion export_pdf.gs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function exportSheetAsPdf(spreadsheetId, sheetName, folderId, includeTimestamp)
`&left_margin=0.75` +
`&right_margin=0.75` +
`&printtitle=true` + // スプレッドシートのタイトルをヘッダーに挿入
`&pagenum=CENTER`; // ページ番号をフッターに挿入 (より汎用的な設定)
`&pagenum=CENTER` + // ページ番号をフッターに挿入 (より汎用的な設定)
`&gridlines=false`; // グリッド線非表示

// 注: ヘッダーの右にエクスポート日時を挿入する、またはヘッダーの中心にワークブックのタイトルを挿入する
// 直接的なURLパラメータはありません。`printtitle=true`は通常左上にタイトルを挿入します。
Expand Down
29 changes: 28 additions & 1 deletion main.gs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function onOpen() {
var ui = SpreadsheetApp.getUi();
var menu = ui.createMenu('出版');
menu.addItem('変更内容を登録', 'showCommitRevision')
menu.addItem('Google Chat に送信', 'mergeMain');
menu.addItem('Google Chat に送信', 'mergeMainPermission');
menu.addToUi();
}

Expand All @@ -15,6 +15,16 @@ function showCommitRevision() {
SpreadsheetApp.getUi().showSidebar(html);
}

// 本当に Google Chat に送信してよいか確認するダイアログ
function mergeMainPermission() {
var ui = SpreadsheetApp.getUi();
var response = ui.alert("Google Chat に送信します", ui.ButtonSet.OK_CANCEL);

if (response == "OK") {
mergeMain();
}
}

// 変更内容の保存
function saveCommitRevision(changes) {
const activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet();
Expand Down Expand Up @@ -75,6 +85,18 @@ function mergeMain() {
changes.push(changelogs[i][2])
}

// 編集者のメールアドレスを取得
var editorEmail = []
for (let i = 0; i < changelogs.length; i++) {
editorEmail.push(changelogs[i][1])
}

// 出版者の情報を取得
const publisherEmail = Session.getActiveUser().getEmail();
const editorSheet = ss.getSheetByName(".editor");
const editors = editorSheet.getRange(2, 1, editorSheet.getLastRow() - 1, 2).getValues();
const publisherName = editors.find(row => row[0] === publisherEmail)[1];

// バージョン表記の更新
// '.config'!B2: バージョン情報が記載されたせる
const configSheet = ss.getSheetByName(".config")
Expand All @@ -99,6 +121,11 @@ function mergeMain() {
// Google Chat で送信
const message_content = {
"sheetName": sheetName,
"publisher": {
"name": publisherName,
"email": publisherEmail
},
"editor": Array.from(new Set(editorEmail)),
"changes": changes,
"download": {
"color": color_data.sharingUrl,
Expand Down
13 changes: 13 additions & 0 deletions notice.gs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,25 @@ function sendGooglechat(messageContents, webhookUrl) {

// 送信するテキストメッセージ
const textMessage = "「" + messageContents.sheetName + "」が更新されました。";

// 貢献者の情報
let contributor = messageContents.editor;
contributor.push(messageContents.publisher.email);
contributor = Array.from(new Set(contributor));

var contributorMessage;
if (contributor.length - 1 > 0){
contributorMessage = messageContents.publisher.name + " と他" + Number(contributor.length - 1) + "人の編集者";
} else {
contributorMessage = messageContents.publisher.name + "によって出版";
}

// 送信するカードのJSON
const cardMessage =
{
"header": {
"title": messageContents.sheetName,
"subtitle": contributorMessage
},
"sections": [
{
Expand Down