SOLVED

How to export files to SharePoint document library with metadata

%3CLINGO-SUB%20id%3D%22lingo-sub-2669275%22%20slang%3D%22en-US%22%3EHow%20to%20export%20files%20to%20SharePoint%20document%20library%20with%20metadata%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2669275%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%201000s%20files.%20I%20also%20have%20several%20metadata%20to%20be%20assigned%20to%20each%20file.%3C%2FP%3E%3CP%3EI%20want%20to%20upload%20those%20files%20into%20my%20SharePoint%20document%20library.%3C%2FP%3E%3CP%3EI%20am%20planning%20to%20create%20and%20cvs%2Fexcel%20file%20and%20add%20all%20files%20name%20and%20assigned%20them%20with%20metadata.%3C%2FP%3E%3CP%3EThen%20I%20want%20to%20upload%20all%20files%20into%20the%20document%20library%26nbsp%3B%20and%20assign%20those%20metadata%20automatically%20via%20PowerShell.%3C%2FP%3E%3CP%3EBut%20I%20do%20not%20know%20how%20to%20do%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20some%20of%20you%20may%20know%20the%20solution.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELooking%20forward%20to%20hearing%20from%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2669275%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2669934%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20export%20files%20to%20SharePoint%20document%20library%20with%20metadata%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2669934%22%20slang%3D%22en-US%22%3EIf%20you%20have%20exactly%20the%20same%20metadata%20in%20the%20source%20and%20destination%20library%2C%20the%20Move%20to%20option%20should%20move%20not%20only%20the%20files%2C%20but%20also%20their%20metadata.%20I%20would%20recommend%20to%20make%20a%20test%20of%20this%20feature%20to%20evaluate%20how%20it%20works.%20If%20you%20still%20decide%20to%20go%20for%20the%20scripting%20option%2C%20here%20you%20have%20a%20sample%20of%20how%20to%20do%20it%3A%20%3CA%20href%3D%22https%3A%2F%2Fwww.sharepointdiary.com%2F2016%2F06%2Fupload-files-to-sharepoint-online-using-powershell.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.sharepointdiary.com%2F2016%2F06%2Fupload-files-to-sharepoint-online-using-powershell.html%3C%2FA%3E%20(Please%2C%20bear%20in%20mind%20that%20you%20might%20to%20update%20the%20PowerShell%20cmdlets%20being%20used%20in%20the%20sample)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2673376%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20export%20files%20to%20SharePoint%20document%20library%20with%20metadata%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2673376%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F60%22%20target%3D%22_blank%22%3E%40Juan%20Carlos%20Gonz%C3%A1lez%20Mart%C3%ADn%3C%2FA%3E%2C%20It%20does%20not%20work%20in%20this%20way.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20have%20M-Files%20application.%20This%20application%20stores%20all%20files%20and%20then%20categorize%20them%20by%20metadata.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20export%20the%20files%20from%20the%20M-Files%2C%20it%20gives%20me%20two%20files.%201-An%20excel%20that%20shows%20all%20metadata.%202-Folder%20that%20shows%20all%20Files%2Fdocuments.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20upload%20all%20documents%20in%20a%20SharePoint%20document%20library%20is%20easy.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20then%20I%20have%20to%20g%20into%20the%20document%20library%20and%20create%20each%20metadata%20that%20is%20in%20the%20excel%20files%20and%20then%20go%20through%2010.0000%20files%20and%20assign%20them%20to%20each%20metadata%20based%20on%20the%20excel%20file.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20I%20think%20there%20must%20be%20a%20solution%20such%20as%3A%3C%2FP%3E%3CP%3E1-Create%20SharePoint%20document%20library%20(I%20can%20do%20it%20manually)%26nbsp%3B%3C%2FP%3E%3CP%3E2-Create%20all%20metadata%20that%20is%20in%20excel%20sheet(which%20I%20got%20it%20when%20I%20export%20files%20from%20the%20M-Files%20application)%20(I%20can%20do%20it%20manually%20)%26nbsp%3B%3C%2FP%3E%3CP%3E3-Uplaod%20all%20files.(I%20can%20do%20it%20manually%20or%20PowerShell)%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20far%20so%20good.%20I%20need%20a%20help%20from%20here%20on...%3C%2FP%3E%3CP%3E4-I%20need%20a%20PowerShell%20script%20that%20can%20upload%20my%20excel%20sheet(from%20my%20computer)%20which%20has%20all%20metadata%20to%20the%20SharePoint%20document%20library%20(created%20at%20step-1)%20and%20can%20map%2Fassign%20those%20metadata%20to%20the%20relevant%20files%20that%20I%20upload%20at%20step%203.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20that%20is%20clear.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello All,

 

I have 1000s files. I also have several metadata to be assigned to each file.

I want to upload those files into my SharePoint document library.

I am planning to create and cvs/excel file and add all files name and assigned them with metadata.

Then I want to upload all files into the document library  and assign those metadata automatically via PowerShell.

But I do not know how to do it.

 

I hope some of you may know the solution.

 

Looking forward to hearing from you.

 

Thanks.

4 Replies
best response confirmed by nnkaya (New Contributor)
Solution
If you have exactly the same metadata in the source and destination library, the Move to option should move not only the files, but also their metadata. I would recommend to make a test of this feature to evaluate how it works. If you still decide to go for the scripting option, here you have a sample of how to do it: https://www.sharepointdiary.com/2016/06/upload-files-to-sharepoint-online-using-powershell.html (Please, bear in mind that you might to update the PowerShell cmdlets being used in the sample)

Hi @Juan Carlos González Martín, It does not work in this way.

 

We have M-Files application. This application stores all files and then categorize them by metadata.

 

When I export the files from the M-Files, it gives me two files. 1-An excel that shows all metadata. 2-Folder that shows all Files/documents.

 

To upload all documents in a SharePoint document library is easy.

 

But then I have to g into the document library and create each metadata that is in the excel files and then go through 10.0000 files and assign them to each metadata based on the excel file.

 

However, I think there must be a solution such as:

1-Create SharePoint document library (I can do it manually) 

2-Create all metadata that is in excel sheet(which I got it when I export files from the M-Files application) (I can do it manually ) 

3-Uplaod all files.(I can do it manually or PowerShell) 

So far so good. I need a help from here on...

4-I need a PowerShell script that can upload my excel sheet(from my computer) which has all metadata to the SharePoint document library (created at step-1) and can map/assign those metadata to the relevant files that I upload at step 3.

 

Hope that is clear.

 

Thanks

 

The second link points you to an example about how to update file metadata with PowerShell. The script can be extended to read the metadata from an Excel / CSV file and the logic necessary to iterate through the files and properly update the metadata. Good luck!

Hi @Juan Carlos González Martín ,

 

I tried that with exactly the same excel sheet and the same columns. It gives me the following error:

Get-PnPListItem : No list found with id, title or url 'Bulk'
At line:10 char:14
+ ... ListItems = Get-PnPListItem -List $ListName -PageSize 2000 -Fields "F ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Get-PnPListItem], PSArgumentException
+ FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Lists.GetListItem