Skip to content

Commit

Permalink
Merge pull request #10 from un-loop/2-Backfill-submissions
Browse files Browse the repository at this point in the history
Backfill and Manual Data Submission to Lob #2
  • Loading branch information
shankj3 authored Jan 8, 2021
2 parents 51e81ce + df0900a commit 33757d0
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions Code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,28 @@ const retryFailedPost = () => {
}
}

const manualPostToLob = () => {
const sheet = SpreadsheetApp.getActiveSheet();
const header = Header.fieldToIndex(sheet, requiredFields);
const activeRowNum = sheet.getActiveRange().getRow();
const activeRows = sheet.getActiveRange().getValues();
Logger.log('activeRowNum: ', activeRowNum);
Logger.log('activeRows: ', activeRows);
// let highlightedRowCount = sheet.getActiveRange().getNumRows();

let updatedRows:string[][] = [[]]

for (let i = 0; i < activeRows.length; i++) {
let updatedRow = activeRows[i]
const submission = new UserSubmission(header, i + activeRowNum, sheet);
submission.postToLob();
}
}

const onOpen = () => {
const ui = SpreadsheetApp.getUi();
ui.createMenu('Special Features')
.addItem('Batch PostToLob', 'postToLob')
.addItem('Manual Retry', 'retryFailedPost')
ui.createMenu('Create Postcard')
.addItem('Manually Create Postcard', 'manualPostToLob')
.addItem('Create Postcard Help', 'showHelp')
.addToUi();
}

0 comments on commit 33757d0

Please sign in to comment.