If your XML is previously exported Intellij you can simply do:
File > Import Settings > select your xml
If its custom defined, one you can try copying your xml to intellij config directory:
config/codestyles
Assuming your xml is in format intellij can understand, it will then show up in
Code Styles > Manage
If your XML is in different format, try to match tags with one of pre-defined styles(also XML)
Answer from hitz on Stack Overflowconfiguration - How to import .XML code style into IntelliJ Idea 15 - Stack Overflow
How to configure Google Java Code Formatter in Intellij IDEA 17? - Stack Overflow
java - How to export all my Intellij code styles to a .editorconfig file? - Stack Overflow
New to IntelliJ, what are ur plugin recommendations?
If your XML is previously exported Intellij you can simply do:
File > Import Settings > select your xml
If its custom defined, one you can try copying your xml to intellij config directory:
config/codestyles
Assuming your xml is in format intellij can understand, it will then show up in
Code Styles > Manage
If your XML is in different format, try to match tags with one of pre-defined styles(also XML)
For users coming here for the same issue but recent IntelliJ version (like 20), it is a bit different now. Once you've exported your formatter in XML, then follow these steps:
- Go to Preferences
- Select Editor
- Sele Code Style
- Select the language of your choice (eg Java)
- Go to Scheme at the top, click on the setting button by the side
- Select the option to import scheme, choose your formatter type and select the xml file. Then save and apply.

If you see error "IntelliJ IDEA code style XML import failed with error message: null", check to ensure your XML file has the file definition <?xml version="1.0" encoding="UTF-8"?> at the top.
NOTE: This is for MacBook. I believe the difference won't be much in other platforms.
This problem can be solve installing the google-java-format Plugin.
Open plugins window (CTRL+Shift+A): plugins
Click on browse repositories.
Search for google-java-format
Install the plugin.
Restart the IDE.
Enable the plugin executing the action (Ctrl+Shift+A): Reformat with google-java-format Update: in the newer version of the plugin select Reformat since the plugin overrides / enhances the functionality of the standard "Reformat" command.
Additional notes from the google-java-format README
The plugin will be disabled by default. To enable it in the current project, go to File→Settings...→google-java-format Settings (or IntelliJ IDEA→Preferences...→Other Settings→google-java-format Settings on macOS) and check the Enable google-java-format checkbox. (A notification will be presented when you first open a project offering to do this for you.)
To enable it by default in new projects, use File→Other Settings→Default Settings....
As mentioned Here, Download the intellij-java-google-style.xml file from the This Link.
Then in Intellij, go Under Settings -> Editor -> Code Style. there in Scheme settings (settings icon on right side) -> import schemes-> intellij idea code style xml. Select the xml downloaded in first step. then in Scheme dropdown select the GoogleStyle IDE (newly added style). Click on apply and close.
Go to "File->Settings (Preferences in OS X)->Editor->Code Style". At the bottom of the right pane there is a section for Editor Config options, which now includes an "Export" button. This will only export formatting options that are available in the Editor Config specification.

To include advanced options from IDEA you will have to save IntelliJ specific files with the project.
If you want to do this without saving the entire ".idea" folder and "*.iml" files, you can also export the IDEA configuration to an xml file and save in a place where everyone can get to it.
- In "File->Settings->Editor->Code Style". At the top of the right pane, there will be a "Scheme" field with an dropdown of options.
- Next to the dropdown is a cog/gear image that will expand to give some options depending on which scheme you have selected.
- The two options you need are the "Export..." option and the "Import Scheme" options which do what their names imply.
With later Intellijs (I'm using 2020.1), the configuration export is available via Settings -> Editor -> Code Style and then the gear icon. See the screenshot below, and the selected menu options:
