![]() Hope you’re having a great day and this is of use. This is a great way to present information gathered from a CSV via a webpage. Hopefully the above has given you some ideas on how you can use string manipulation to convert a CSV file into a Confluence Wiki Markdown Table. Gets only the specified number of objects. Pandoc is a Haskell library for converting from one markup format to another, and a command-line tool that uses this library. It can also select unique objects, a specified number of objects, or objects in a specified position in an array. Selects specified properties of an object or set of objects. Gets objects that represent the services on a computer. Specifies the objects to be written to the file. AppendĪdds output to the end of an existing file, instead of replacing the file contents. |AppIDSvc|Application Identity|Stopped|Win32ShareProcess| |ApHidMonitorService|Alps HID Monitor Service|Running|Win32OwnProcess| |ALG|Application Layer Gateway Service|Stopped|Win32OwnProcess| |AJRouter|AllJoyn Router Service|Stopped|Win32ShareProcess| |AdobeARMservice|Adobe Acrobat Update Service|Running|Win32OwnProcess| ![]() # Contents of CSV file "Name", "DisplayName", "Status", "ServiceType" "AdobeARMservice", "Adobe Acrobat Update Service", "Running", "Win32OwnProcess" "AJRouter", "AllJoyn Router Service", "Stopped", "Win32ShareProcess" "ALG", "Application Layer Gateway Service", "Stopped", "Win32OwnProcess" "ApHidMonitorService", "Alps HID Monitor Service", "Running", "Win32OwnProcess" "AppIDSvc", "Application Identity", "Stopped", "Win32ShareProcess" # Contents of file after running the conversion script and changing it to an MD file ||Name||DisplayName||Status||ServiceType|| Get-Service | Select-Object -First 5 -Property Name,DisplayName,Status,ServiceType | Export-CSV $env:TEMP\20180821_AutoDoco.csv ExampleĪs an example to show the conversion. Since the packaged index.js is run from the dist folder. Packaging the action will create a packaged action in the dist folder. Out-File is then used to write the string to a file at $outputlocation and use $content as the InputObject. Packaging assembles the code into one file that can be checked in to Git, enabling fast and reliable execution and preventing the need to check in nodemodules. The comma is replaced with blank and any instance of || is replaced with a single |. If the content is not a header, the else statement is invoked and replaces “ with |. * Out-File is then used to write the string to a file at $outputlocation and use $content as the InputObject. , replace the *, with blank and then remove any instance of * If the content is a header $header = $contents & if($content -eq $header) it will replace ” with * ![]() $outputlocation = " $env :TEMP\ $date `_ AutoDoco.md" foreach ( $content in $contents ) #end region Explanation The conversion takes a CSV file $input = (Get-Content $env:TEMP$date`_AutoDoco.csv) and then uses string manipulation to format the content. $date = ( Get-Date -Format yyyyMMdd ) $input = ( Get-Content $env:TEMP\ $date `_AutoDoco.csv ) $contents = $input $header = $contents
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |