Last active
March 15, 2024 08:11
-
-
Save oshinko/cd0ca89aff473ab390a8e4710d58ad04 to your computer and use it in GitHub Desktop.
For the ToDo list of Google Spreadsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sort() { | |
const TARGET_SHEETS = ['全て'] | |
const sheet = SpreadsheetApp.getActiveSheet() | |
if (!TARGET_SHEETS.includes(sheet.getName())) | |
return | |
const [_, targetColumn] = sheet | |
.getRange(1, 1, 1, sheet.getMaxColumns()) | |
.getValues() | |
.flat() | |
.map((x, i) => [x, i + 1]) | |
.find(([x]) => x === '優先順') | |
const range = sheet.getRange(1, targetColumn, sheet.getMaxRows()) | |
if (range.getValues().flat().some(x => x === '')) | |
return | |
sheet.sort(targetColumn) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment