Hi All,<\/p>\n
Each month we get alot of excel .xlsx sheets to email each month, the file name contains the users name so i would like to do the following if possible<\/p>\n
marc woods.xlsx email that file to [email protected]<\/a><\/p>\n joe blog.xlsx email that file to [email protected]<\/a><\/p>\n and so on<\/p>\n Anyone point me in the right direction?<\/p>\n Thank you<\/p>","upvoteCount":4,"answerCount":7,"datePublished":"2018-12-04T13:22:23.000Z","author":{"@type":"Person","name":"marcwoods","url":"https://community.spiceworks.com/u/marcwoods"},"suggestedAnswer":[{"@type":"Answer","text":" Hi All,<\/p>\n Each month we get alot of excel .xlsx sheets to email each month, the file name contains the users name so i would like to do the following if possible<\/p>\n marc woods.xlsx email that file to [email protected]<\/a><\/p>\n joe blog.xlsx email that file to [email protected]<\/a><\/p>\n and so on<\/p>\n Anyone point me in the right direction?<\/p>\n Thank you<\/p>","upvoteCount":4,"datePublished":"2018-12-04T13:22:23.000Z","url":"https://community.spiceworks.com/t/powershell-email-multiple-excel-files-to-users/686898/1","author":{"@type":"Person","name":"marcwoods","url":"https://community.spiceworks.com/u/marcwoods"}},{"@type":"Answer","text":" Can you export the Files directly with the right names like joe.blog.xlsx instead of joe blog? $path= C:\\some\\lokal\\folder<\/em><\/p>\n Get-Childitem -File -Filter *.pst -Path $path | % {$_.BaseName}<\/i> $files= Get-Childitem -File -Filter *.xlsx -Path $path| % {$_.BaseName}<\/i><\/p>\n Foreach ($address in $files){<\/em><\/p>\n send mail to $address<\/em> + “domain.com<\/a>”<\/em> edit: so<\/p>\n Foreach ($address in $files){<\/em> send mail to $address<\/em> + “domain.com<\/a>”<\/em> Yeah, if it’s just the file name, and formatted like this every time, that’s easy.<\/p>\n If you need to read the excel file in, I’d reccomend, look into the ‘ImportExcel’ tool by Doug Finke<\/a> .<\/p>\n If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>
\nMaybe this helps you (I used this for an automatic pst import into our Exchange servers)<\/p>\n
\nso yours would be like:<\/p>\n
\n}<\/em><\/p>\n
\nI checked something and you could use -repülace to replace the spaces with dots!<\/p>\n
\n$address = $address -replace \" “,”.\"<\/em><\/p>\n
\n}<\/em><\/p>","upvoteCount":2,"datePublished":"2018-12-04T13:39:36.000Z","url":"https://community.spiceworks.com/t/powershell-email-multiple-excel-files-to-users/686898/2","author":{"@type":"Person","name":"jb04","url":"https://community.spiceworks.com/u/jb04"}},{"@type":"Answer","text":"