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 main(workbook: ExcelScript.Workbook) { | |
let range = workbook.getActiveCell(); | |
console.log("value:" + range.getValue() + ", text:" + range.getText()); //getValueとgetTextの違い | |
} |
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 main(workbook: ExcelScript.Workbook) { | |
let range = workbook.getActiveCell(); | |
range.setValue("こんにちは、世界!"); | |
} |
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 main(workbook: ExcelScript.Workbook) { | |
let sheet = workbook.getActiveWorksheet(); | |
sheet.getRange("B2").select(); //セルB2を選択 | |
} |
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 main(workbook: ExcelScript.Workbook) { | |
let sheet = workbook.getWorksheet("Sheet1"); | |
sheet.getRange("B2").select(); //セルB2を選択 | |
} |
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 main(workbook: ExcelScript.Workbook) { | |
let sheet = workbook.getWorksheet("Sheet1"); | |
if (sheet !== void 0) { //存在しないシートの場合はundefinedが返ってくる | |
sheet.getRange("B2").select(); //セルB2を選択 | |
} | |
} |
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 main(workbook: ExcelScript.Workbook) { | |
let sheet = workbook.getFirstWorksheet(); //メソッドの引数にtrueを指定すると非表示のシートをスキップ | |
sheet.getRange("B2").select(); //セルB2を選択 | |
} |
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 main(workbook: ExcelScript.Workbook) { | |
let sheet = workbook.getLastWorksheet(); //メソッドの引数にtrueを指定すると非表示のシートをスキップ | |
sheet.getRange("B2").select(); //セルB2を選択 | |
} |
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 main(workbook: ExcelScript.Workbook) { | |
let currentSheet = workbook.getActiveWorksheet(); | |
let sheet = currentSheet.getNext(); //メソッドの引数にtrueを指定すると非表示のシートをスキップ | |
sheet.getRange("B2").select(); //セルB2を選択 | |
} |
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 main(workbook: ExcelScript.Workbook) { | |
let currentSheet = workbook.getActiveWorksheet(); | |
let sheet = currentSheet.getPrevious(); //メソッドの引数にtrueを指定すると非表示のシートをスキップ | |
sheet.getRange("B2").select(); //セルB2を選択 | |
} |
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
//n番目のシートを取得 | |
function main(workbook: ExcelScript.Workbook) { | |
let sheet = workbook.getWorksheets()[1]; //2番目のシートを取得 | |
sheet.getRange("B2").select(); //セルB2を選択 | |
} |
OlderNewer