Hi SangThao,
Thank you for posting on Microsoft Community.
I understand that you’re having trouble changing the stylesheet associated with your XML file in Excel. Once you open an XML file in Excel and associate it with a stylesheet (XSL or XSLT), Excel “remembers” that association and does not easily allow switching to a different stylesheet for that file.Here’s how you can regain control and apply a different stylesheet to your XML file:1. Remove the Stylesheet Processing Instruction from the XMLOpen your XML file in a text editor (like Notepad or VS Code) and look for a line near the top like:
- Delete this line, or change the href to the path of your new stylesheet.
- Save the XML file.
- Now, when you open the XML in Excel, it should prompt you to select a stylesheet again.
****2. Open the XML in Excel Without Stylesheet
- Open Excel.
- Go to File > Open and select your XML file.
- If prompted, choose As an XML table (not as a read-only workbook).
- If Excel does not prompt for a stylesheet, it’s because of the processing instruction. Remove it as described above.
3. Use “Open With” and Specify the StylesheetIf you want to force Excel to use a different stylesheet:
- Make a copy of your XML file.
- In the copy, update the line to point to your desired XSL file.
- Open this new XML file in Excel.
For reference: Overview of XML in Excel - Microsoft Support
If none of the above solutions work, let me know for further investigation. Please note that our initial response does not always resolve the issue immediately. However, with your help and more detailed information, we can work together to find a solution.
Kind regards,
Hoang-D - MSFT | Microsoft Community Support Specialist