Skip to content

Commit

Permalink
Added getActiveBookName to xlwings.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fzumstein committed Feb 22, 2024
1 parent 08ac988 commit 64926cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions xlwingsjs/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export async function getActiveBookName() {
try {
return await Excel.run(async (context) => {
const workbook = context.workbook;
workbook.load("name");
await context.sync();
return workbook.name;
});
} catch (error) {
console.error(error);
}
}
2 changes: 2 additions & 0 deletions xlwingsjs/src/xlwings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import "core-js/actual/function/name";
import { xlAlert } from "./alert";
import { getAccessToken } from "./auth";
export { getAccessToken };
import { getActiveBookName } from "./utils";
export { getActiveBookName };

const version = "dev";
globalThis.callbacks = {};
Expand Down

0 comments on commit 64926cf

Please sign in to comment.