1

I am trying to take data from a webform that is generated in pdf format and migrate it to csv so I can use my limited powershell knowledge to automate VM builds. This is all done on linux as well. This is what I have so far and that seems to work, but I need to automate it all so I need to use wildcards as the file names will change.

pdftotext  -nopgbrk './AndyTest-2 - Linux - Debian 10_13.pdf' test.txt

Import-Csv test.txt | Export-Csv test.csv

1 Answer 1

0

Cool - it sounds like you've already got 90+% of the solution.

Why not just call your PS script with parameters?

Example:

$PdfFile=$args[0]
$TxtFile=$args[1]
$CsvFile=$args[2]
pdftotext  -nopgbrk $PdfFile $TxtFile
Import-Csv test.txt | Export-Csv $CsvFile

One possible "gotcha" is that apparently have spaces in your .Pdf filenames. One solution is to quote your variable, e.g.:

"$PdfFile"

Look here for more ideas:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.