{"id":158,"date":"2012-11-16T14:30:28","date_gmt":"2012-11-16T20:30:28","guid":{"rendered":"https:\/\/sharepointhacker.com\/?p=158"},"modified":"2012-11-16T14:30:28","modified_gmt":"2012-11-16T20:30:28","slug":"powershell-to-get-totals-of-excel-spreadsheet-column-and-post-to-sharepoint-list","status":"publish","type":"post","link":"https:\/\/sharepointhacker.com\/?p=158","title":{"rendered":"PowerShell to get totals of Excel SpreadSheet Column and Post to Sharepoint List"},"content":{"rendered":"<p>This is a simple little script that I added on to a previous script to get Computer Bitlocker Report and Post the totals to Sharepoint 2010 List<\/p>\n<p><code><br \/>\n# Check if the Sharepoint Snapin is loaded already, and load if not<br \/>\nif ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )<br \/>\n{<br \/>\nAdd-PSSnapin Microsoft.SharePoint.PowerShell<br \/>\n}<\/p>\n<p>$reportcsv = Import-CSV q:\\<CSVFileName>.csv<\/p>\n<p>$totalTrue = $reportcsv | Where-Object {$_.<ColumnName> -eq \"TRUE\"} | Measure-Object HasBitlockerRecoveryKey -line<br \/>\n$totalFalse = $reportcsv | Where-Object {$_.<ColumnName> -eq \"FALSE\"} | Measure-Object HasBitlockerRecoveryKey -line<\/p>\n<p>#Setting our variables, Site name, List name, file to import and Caml<br \/>\n$spWeb = Get-SPWeb -Identity \"https:\/\/<SharepointSite>\"<br \/>\n$Summarylist = $spWeb.Lists[\"<ListName>\"]<\/p>\n<p>#adds Report to SharePoint List<br \/>\n$item = $list.Items.Add();<br \/>\n$item[\"True\"] = $totalTrue.lines;<br \/>\n$item[\"False\"] = $totalFalse.lines;<br \/>\n$item.Update();<br \/>\n<\/code><\/p>\n<p>Of course you should replace the <Variables> that I put in above with your info, but you get the idea.<\/p>\n<p>Kevin<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a simple little script that I added on to a previous script to get Computer Bitlocker Report and Post the totals to Sharepoint 2010 List # Check if the Sharepoint Snapin is loaded already, and load if not if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) { Add-PSSnapin Microsoft.SharePoint.PowerShell } $reportcsv [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[11,4],"tags":[41,30,26,40],"class_list":["post-158","post","type-post","status-publish","format-standard","hentry","category-powershell","category-sharepoint-2010","tag-automation","tag-bitlocker","tag-lists","tag-reporting"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p289k1-2y","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/sharepointhacker.com\/index.php?rest_route=\/wp\/v2\/posts\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sharepointhacker.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sharepointhacker.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sharepointhacker.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sharepointhacker.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=158"}],"version-history":[{"count":2,"href":"https:\/\/sharepointhacker.com\/index.php?rest_route=\/wp\/v2\/posts\/158\/revisions"}],"predecessor-version":[{"id":160,"href":"https:\/\/sharepointhacker.com\/index.php?rest_route=\/wp\/v2\/posts\/158\/revisions\/160"}],"wp:attachment":[{"href":"https:\/\/sharepointhacker.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sharepointhacker.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sharepointhacker.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}