When you upload a docx to a document library, SharePoint adds custom column metadata to the document. For example: I’ve added 2 custom columns to a library. 1 Text field (CustomColumn1) and a dropdown column (CustomColumn2). Next I create an example docx document named “my_testdocument.docx”. I upload the testdocument to the document library and fill in the extra metadata:

Upload the docx document and fill in the custom metadata

Next I download the document to my desktop and change the docx extension to zip, so I can open the document. You can see that inside docx is completely xml:

docx to zip

I open the zip and look in the “customXml” folder for my custom columns. They appear in a file named “item2.xml”. Next I open the “item2.xml” file with an editor (in my case visual studio) and change the values of my custom column metadata:

change metadata values

After saving the file and renaming the file to “my_testdocument2.docx” I upload the edited file to the SharePoint Library:

new metadata

SharePoint adds the updated metadata to the custom Library columns.