LoginSignup
2
3

More than 5 years have passed since last update.

HTMT仕事でのメモ

Last updated at Posted at 2014-11-20

2014_11_17業務内容とMemo

業務内容

  1. 重複管理チェックソフト作成
    • 詳細     :google apps scriptで作った
    • 学んだ事   :google apps script
    • 次に活かせる事:不明(やっぱり、IT系って効率的な構築やルールを守ると言う考え方大事、そしてユーザーとの意思疎通。何か作ってる途中に、こうすれば良いのにって、思ってしまう。)

Memo

作るにあたって参考にしたサイト

正規表現
google API
Google Apps Scriptリファレンス

仕事で感じた事

1について、重複管理チェックソフト作成のソース

function duplication _check() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
// var objCell = sheet.getActiveCell();
var count=0;

// var gyou = objCell.getRow()
var gyou = GetActiveCell(sheet);

var org_book = sheet.getRange("B"+gyou).getValue();
fomart(sheet,gyou);

var last_index = gyou

for (var i = 1; i <= last_index; i++) {
var search_book = sheet.getRange("B" + i).getValue();
fomart(sheet,i);
if((gyou != i) && (org_book == search_book)) {
count=1;
Browser.msgBox("B "+ i+"にこの書籍はすでにあります");
break;
}
}

if(count == 0)Browser.msgBox("B "+ i+"この書籍は重複していませんでした");
}

function fomart(sheet, i){
var test = sheet.getRange("B"+i).getValue();

var res = test.replace(/[A-Za-z0-9]/g, function(s) {
return String.fromCharCode(s.charCodeAt(0) - 0xFEE0);
});

sheet.getRange("B"+i).setValue(res);

}

function onOpen(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menus = [{name: '重複チェック', functionName: 'hon'},
];
ss.addMenu('便利メニュー', menus);
}

function GetActiveCell(sheet) {

var objCell = sheet.getActiveCell();

var gyou = objCell.getRow()
return gyou
}
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3