Asked by:
creating multiple txt files and directories from csv column and have the txt files filled with specific text

Question
-
I have an excel file containing MANY names column and many links column, i need to create directories and text files inside them based on the excel column *. text files filled with same text inside them
Lets say i have an excel file containing column:banana,apple
The output would be Banana directory,apple directory.
Inside apple directory apple.text,inside banana directory a file called banana.text.
Inside the text files banana.text and apple.text i would like to have the same specific text WITH the links as variable inside banana.txt the same text with the apropriate link to banana in the paralel link's column and for apple.text same specific text with the appropriate link to apple in the alink's column pls .Wednesday, November 1, 2017 3:06 AM
All replies
-
Please read this first: https://social.technet.microsoft.com/Forums/scriptcenter/en-US/c47b1bc2-f7fd-4d2e-8ff2-e8a81ce090d4/this-forum-is-for-scripting-questions-rather-than-script-requests?forum=ITCG
Also find scripts here: http://gallery.technet.microsoft.com/
Learn PowerShell: https://mva.microsoft.com/en-us/training-courses/getting-started-with-microsoft-powershell-8276
Script requests: https://gallery.technet.microsoft.com/scriptcenter/site/requests
\_(ツ)_/
Wednesday, November 1, 2017 3:18 AM -
Hi,
Based on my research, you could have a try with the following demo scripts to achieve your goal. Hope it is helpful to you:
1. Get data from Excel:
$excelpath = 'D:\Book1.xlsx' $excelsheet = 'Sheet1' $excel = New-Object -ComObject Excel.Application $workbook = $excel.WorkBooks.Open("$excelpath") $sheet = $workbook.Sheets.Item("$excelsheet") $sheet.Columns.Item(1).Value2
2. Create directories and files
New-Item -Path 'D:\' -Name 'Apple' -ItemType Directory New-Item -Path 'D:\Apple' -Name 'Apple.txt'
3. Add data to a text file
Add-Content -Path 'D:\Apple\Apple.txt' -Value 'Apple'
If you need further help, please feel free to let us know.
Best Regards,
Albert LingPlease remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com- Proposed as answer by Albert LingMicrosoft contingent staff Tuesday, November 7, 2017 8:21 AM
Wednesday, November 1, 2017 7:19 AM -
Hi,
Just checking in to see if the information provided was helpful.
Please let us know if you would like further assistance.
Best Regards,
Albert LingPlease remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.comFriday, November 3, 2017 7:17 AM -
Hi,
I am checking how the issue is going, if you still have any questions, please feel free to contact us.
If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
If no, please reply and tell us the current situation in order to provide further help.
Appreciate for your feedback.
Best Regards,
Albert LingPlease remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.comTuesday, November 7, 2017 8:21 AM