Print date and time in excel in footer programmatically using Aspose Cells for Java API

@amjad.sahi Is it possible to print date and time in excel in footer programmatically using Aspose Cells for Java API?

@sabkan,

You may use “&D” command/script for current date and “&T” to set/ current time in the header/footer for your needs. See the following sample code for your reference.
e.g.
Sample code:

// Instantiate and load the Excel file
Workbook workbook = new Workbook("Book1.xlsx");

// Obtaining the reference of the PageSetup of the first worksheet
PageSetup pageSetup = workbook.getWorksheets().get(0).getPageSetup();

// Setting worksheet name at the left header
pageSetup.setHeader(0, "&A");

// Setting current date and current time at the right footer and changing the font of the footer
pageSetup.setFooter(2, "&\"Times New Roman,Bold\"&D-&T");

// Saving the Excel file
workbook.save("SetDateTimeFooter_out.xlsx");

Also, see the document for your reference.
https://docs.aspose.com/cells/java/page-setup-features/#setting-headers-and-footers

Hope, this helps a bit.

@amjad.sahi Thanks for the details. Shall check.

@sabkan,

Sure, please take your time to try the suggested code segment. Hopefully, it will work for your needs.