How to Print the Excel Worksheet Name in a Header
Question details
The user wants to display the worksheet name, current page number, and total page count in the header or footer when printing an Excel document.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Preparing an Excel spreadsheet for printing and needing to include identifying information like the sheet name and page numbers in the headers.
- Observed behavior
- The user needs to insert specific ampersand codes to display dynamic worksheet details, and occasionally encounters missing header controls due to frozen top rows.
Ensure you are in the Page Layout view to see headers and footers clearly, and verify that your worksheet does not have hidden frozen panes that might interfere with the header dialogue box.
Insert the Worksheet Name Using Header Codes
Use built-in header and footer ampersand codes to automatically display the worksheet name, current page, and total pages.
Excel uses specific codes to dynamically display workbook properties in headers and footers. These codes ensure that if the worksheet name changes or more pages are added, the printed header updates automatically.
Navigate to the Insert tab on the Excel ribbon and click on Header & Footer. This action will switch your document view to Page Layout and place your cursor inside the header area.
Click on the left, center, or right section of the header area where you want the name to appear. Type the code &tab or click 'Sheet Name' in the Header & Footer Elements group on the ribbon.
To display page numbers in a 'Page X of Y' format, click another section of the header or footer and type &page of &pages. Alternatively, select 'Page Number' and 'Number of Pages' from the ribbon elements.
Click anywhere outside the header area within the standard worksheet cells to apply the changes and return to normal editing.

Fix Missing Header Controls by Unfreezing Panes
Resolve issues where standard header and footer options or macro selection boxes do not appear properly when the top row is frozen.
Easily Add Headers and Footers with WPS Spreadsheet
WPS Office offers an intuitive way to add worksheet names, page numbers, and custom text to your headers and footers without needing to memorize complex ampersand codes.
- 1. Open your spreadsheet: Launch WPS Office and open your existing spreadsheet document in the WPS Spreadsheet application.
- 2. Access the Insert menu: Click on the Insert tab located at the top ribbon and select Header and Footer to open the page setup dialog.
- 3. Select predefined options: In the Header/Footer dialog box, use the preset dropdown menus to automatically insert the worksheet name, file path, or page numbers into your preferred section.
- 4. Confirm and Print: Click OK to save your changes, then go to Menu > Print to preview the document and ensure the worksheet name is displaying perfectly.

Frequently Asked Questions
How do I apply the same worksheet name header to multiple sheets at once?
Hold the Ctrl key and click the tabs of the worksheets you want to modify at the bottom of the screen to group them. Then, go to Insert > Header & Footer to apply the worksheet name code (&tab) to all grouped sheets simultaneously.
Can I format the text of the worksheet name in the header?
Yes. Highlight the &tab code in the header area, go to the Home tab on the ribbon, and apply your desired font, size, or color settings just like you would for regular cell text.
Why doesn't the worksheet name update in the header when I rename the tab?
The worksheet name code (&tab) is dynamic, but it may require a screen refresh to update visually. Switching to Normal view and back to Page Layout view, or opening the Print Preview window, will force the header to reflect the new tab name.
Can I print the file path in the Excel header along with the worksheet name?
Yes, you can combine multiple codes. You can use the &path and &file codes alongside &tab to display the full directory path, the workbook name, and the specific worksheet name in the header or footer.




