공급 업체 티켓을 추적하기 위해 Google 시트에서 통합 문서를 관리합니다. "MasterTracker"라는 탭이 하나 있습니다. 테이블 헤더는 다음과 같습니다.
티켓 번호 | 문제 | 설명 | StatusInternal | StatusVendor | 우선 순위 | 만든 날짜 | 내부 소유자 | 공급 업체 소유자 | 해상도 | 목표 해결 날짜 | 댓글 | 휴관일
지금하려는 것은 "StatusInternal"열 (값 : Open, Hold, Future, Hold)을 기준으로 데이터를 분할하고 열의 각 값에 대한 데이터를 새 통합 문서의 새 탭으로 이동하는 것입니다. 시트 이름으로 상태 이름. 예를 들어 개설, 마감, 보류, 미래 상태의 모든 티켓은 새 통합 문서에서 시트 이름이 "open", "closed", "hold", "future"인 새 시트로 이동하여 Google 드라이브에 저장합니다.
이 새로운 통합 문서는 매일 이메일로 발송되며 현재는 위에서 언급 한 프로세스를 수동으로 수행하고 있습니다.
누군가 Google 스프레드 시트에서 스크립트 나 추가 기능을 제공해 주시겠습니까?
미리 감사드립니다! -알
올바르게 이해했다면 해당 데이터가 포함 된 세 개의 시트 (Open, Hold 및 Future)가 포함 된 새 스프레드 시트를 원합니다.
이것이 내가 시도한 것입니다.
function createSpreadsheets() {
var StatusInternal = ["Open","Hold","Future"];
//Create the new file
var newSprsheet = SpreadsheetApp.create("Status Internal");
for (var i = 0; i < StatusInternal.length; i++){
//Create the new Sheets with the Status Internal names
newSprsheet.insertSheet(StatusInternal[i]);
}
//Activates the first sheet (Sheet1), to delete it, as it is not necessary
newSprsheet.getSheets()[0].activate();
newSprsheet.deleteActiveSheet();
splitData(newSprsheet, StatusInternal);
}
function splitData(newSprsheet, StatusInternal){
var mainSprsheet = SpreadsheetApp.openById("Id of your main Spreadsheet");
var mainSheet = mainSprsheet.getActiveSheet();
//Gets the values of the first row
var headcolumns = mainSheet.getRange("A1:L1").getValues();
//Gets the values of the Status Internal Column
var StatusValues = mainSheet.getRange("C2:C").getValues();
var lastRow = mainSheet.getLastRow();
for (var i = 0; i < 3; i++){
//Copies the first row values to each new Sheet
newSprsheet.getSheets()[i].appendRow(headcolumns[0]);
}
for (var i = 2; i <= lastRow; i++){
//Gets all the values of the row
var rowContents = mainSheet.getRange("A"+i+":L"+i).getValues();
//Appends a new row to the Sheet depending of the value in Column C.
switch(StatusValues[i-2].toString()){
case StatusInternal[0]:
newSprsheet.getSheetByName(StatusInternal[0]).appendRow(rowContents[0]);
break;
case StatusInternal[1]:
newSprsheet.getSheetByName(StatusInternal[1]).appendRow(rowContents[0]);
break;
case StatusInternal[2]:
newSprsheet.getSheetByName(StatusInternal[2]).appendRow(rowContents[0]);
break;
}
}
}
참조 :
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다