0

I have a SharePoint list where I hide a column on the list view but when I download the list it shows up in the excel download. I checked the modified view setting and the hidden column is checked off. How can I not show it in excel download?

Thank!

1
  • Are you using Modern or Classic SharePoint UX? Also, is this field present in any of the forms used to input data? Oct 14, 2021 at 0:49

1 Answer 1

0

Here are two methods for your reference:

SolutionA:

1.In my test, I hide "Brand" and "Site" column in the list

enter image description here

enter image description here

2.Click on Export >> Export to Excel

enter image description here

3.Open the query.iqy file, you cannot see "Brand" and "Site" column in this excel file

enter image description here

SolutionB:

1.Please run the below script as an admin to export items to excel. Note that the value of $SelectedFields should be the internal name of the column

enter image description here

#Parameters
$SiteURL = "https://tenant.sharepoint.com/sites/sitename"
$ListName = "list name"
$SelectedFields = @("ID","Sentiment","Email", "CompletionDate")
$CSVPath = "C:\Temp\ListData.csv"
 
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

#Get List items from the list
$ListItems = Get-PnPListItem -List $ListName -Fields $SelectedFields -PageSize 500
 
#Iterate through each item and extract data
$ListDataColl = @()
$ListItems | ForEach-Object {
    $ListData = New-Object PSObject
    #Get the Field Values of the item as text
    $ListItem  = Get-PnPProperty -ClientObject $_ -Property FieldValuesAsText
    ForEach($Field in $SelectedFields)
    {
        $ListData | Add-Member Noteproperty $Field $ListItem[$Field]
    } 
    $ListDataColl += $ListData 
}
#Export data to CSV
$ListDataColl
$ListDataColl | Export-CSV $CSVPath -NoTypeInformation

enter image description here

2.Open the CSV file, you only see the columns value that you selected

enter image description here

============================ Updated Answer ======================

Please run the below script as an admin:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue 
     
#Get the Web 
$web = Get-SPWeb -identity "http://SiteURL" 
     
#Get the Target List 
$list = $web.Lists["ListName"] 
     
#Array to Hold Result - PSObjects 
$ListItemCollection = @() 
     
#Get All List items by specifying fields 
$list.Items | foreach { 
$ExportItem = New-Object PSObject 
#Specify fields (Add the columns that you want to display) 
$ExportItem | Add-Member -MemberType NoteProperty -name "Title" -value $_["Title"] 
$ExportItem | Add-Member -MemberType NoteProperty -name "Text" -value $_["Text"] 
$ExportItem | Add-Member -MemberType NoteProperty -name "Column1" -value $_["Column1"] 
     
#Add the object with property to an Array 
$ListItemCollection += $ExportItem 
} 

#Export the result Array to CSV file 
$ListItemCollection | Export-CSV "C:\ListData.csv" -NoTypeInformation                        
     
#Dispose the web Object 
$web.Dispose()
4
  • Hi, Thank you but i am using sharepoint 2003. The solutionA does not look same as mine. SolutionB is not possible since I don't know how run a script as an admin. Any other suggestion?
    – Nina
    Oct 18, 2021 at 12:18
  • Hi Nina. Sorry, because your problem tag is SharePoint-Online, so I provide solutions in SharePoint Online. Don’t worry, I will re-provide my solution. Oct 20, 2021 at 1:26
  • Hi Nina. I have updated answer under initial My Answer. Hope this can help you to solve issue. Have a nice day! Oct 20, 2021 at 8:13
  • Sorry but non of this will work for me. I am new to SharePoint site. Also I do not have Poweshell. Is there a script I can use using Sharepoint Developer?
    – Nina
    Oct 22, 2021 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.