Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #109 from hiroxto/start-line
Browse files Browse the repository at this point in the history
登録を開始する行をプロパティで指定できるように改修
  • Loading branch information
hiroxto committed Jul 8, 2021
2 parents e8c5553 + 7516231 commit ed00820
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ $ cp .clasp.example.json .clasp.json
|ADDED_STATUS_VALUE|実行完了後の値|`登録完了`|
|LAST_ROW_STATUS_VALUE|最終行の値. イベントにこれがセットされていると, その行で終了する.|`最終行`|
|BASE_SHEET_NAME|データの入ったシート名|`勤務データ`|
|START_LINE|開始する行.2以上の値.|`2`|

### イベント登録で使うプロパティの設定

Expand Down
6 changes: 5 additions & 1 deletion src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ export class Application {
*/
start (): void {
const sheet = this.getSheet();
const startLine = this.options.startLine;

for (let rowNumber = 2; rowNumber <= sheet.getLastRow(); rowNumber++) {
for (let rowNumber = startLine; rowNumber <= sheet.getLastRow(); rowNumber++) {
const settings = this.loadSettings(sheet, rowNumber);

if (settings.event.status === this.options.lastRowStatusValue) {
Expand Down Expand Up @@ -349,6 +350,8 @@ export function start (): void {

// データの入ったシート名
const baseSheetName = scriptProperties.getProperty('BASE_SHEET_NAME');
// 最終行の status の値
const startLine = +scriptProperties.getProperty('START_LINE');
// 実行する status の値
const executeStatusValue = scriptProperties.getProperty('EXECUTE_STATUS_VALUE');
// 実行完了後にセットする status の値
Expand Down Expand Up @@ -387,6 +390,7 @@ export function start (): void {

const applicationOptions: ApplicationOptions = {
sheetName: baseSheetName,
startLine: startLine,
executeStatusValue: executeStatusValue,
addedStatusValue: addedStatusValue,
lastRowStatusValue: lastRowStatusValue,
Expand Down
1 change: 1 addition & 0 deletions types/application.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface ApplicationOptions {
executeStatusValue: string;
addedStatusValue: string;
lastRowStatusValue: string;
startLine: number;
event: EventOptions;
task: TaskOptions;
}
Expand Down

0 comments on commit ed00820

Please sign in to comment.