0
votes

We want to insert text into headers and footers of an Excel Worksheet using the Office-js Api. Is there any way available now or in the near future to do this?

1

1 Answers

0
votes

This feature got introduced in ExcelApi 1.9 (this May). Documentation

Some example code:

Excel.run(async (context)=>{
  const sheets = context.workbook.worksheets;
  sheets.load({$all: true}); // Load all sheets

  const headerFooter = sheets.getActiveWorksheet().pageLayout.headersFooters.defaultForAllPages;
  headerFooter.load({$all: true}); // Load header/footer

  await context.sync();

  headerFooter.set({leftHeader: 'something'});
});