Google 스프레드 시트에서 내 시트 중 하나의 데이터를 가져 오는 Martin Hawksey의 Google Apps Script 수정 된 버전을 사용하고 있습니다. 다른 시트가 각 시트에 대한 새 행을 만듭니다 이벤트 설명 열 (쉼표로 구분됨 - 예 : 셀 D2 = "설명 1, 설명 2, 설명 3 등).이 기능은 매우 훌륭하지만 한 가지 더 많은 기능을 수행하고 싶습니다. (아마도 쉼표 대신 세미콜론으로 분리 된) 이벤트 설명의 마지막 항목을 가져 와서 세미콜론이나 다른 구분 기호를 삭제하는 동안 고유 한 이벤트마다 한 번만 인접 셀에 밀어 넣습니다. 여러 가지 접근 방식이 있지만 Google Apps Script를 처음 사용하는 경우 성공하지 못했습니다.Google 스프레드 시트 셀 값을 인접한 셀로 분할하는 방법
function splitColumnAndRepeatRows(anArray, splitColumnIndex) {
var output = [];
for (i in anArray){ // for each row
var splitArray = anArray[i][splitColumnIndex].toString().split(","); // split values in specified column
for (j in splitArray){ // for each split cell value
if(splitArray[j]=="" && j>=1)
continue;
var row = anArray[i].slice(0); // take a copy of source row
row[splitColumnIndex] = alltrim(splitArray[j]); // replace comma separated value with current split value
output.push(row); // push new row to output
}
}
return output;
}
function alltrim(str) {
return str.replace(/^\s+|\s+$/g, '');
}
는 기본적으로이 내가 할 노력하고있어입니다 -이 설정이로
Date Client County Description
9/21/14 12345 Greene Location 1, Location 2, Location 3; Y
9/24/14 54321 Brown Location 1, Location 2; X
을 :
Date Client County Description Time
9/21/14 12345 Greene Location 1
9/21/14 12345 Greene Location 2
9/21/14 12345 Greene Location 3 Y
9/24/14 54321 Brown Location 1
9/24/14 54321 Brown Location 2 X
어떤 도움도 대단히 감사하겠습니다!
감사합니다.
작품! 도와 주셔서 정말 감사합니다! –