Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a CSV file. I need to print this file row by row.

For example, each row contains name, surname, email, profession and so on, many columns. First row contains the column titles. I would like to print each row on one page. Each data should print like this:

Name: John
Surname: Doe
Email: john@doe.com 

etc, where Name and Surname and Email column names come from the CSV's first row.

Now I'd need to print, let's say 100 rows like this, automatically, from the CSV file. How can I achieve that? I could also do a little programming if necessary.

share|improve this question
2  
Product recommendations are off topic for SU. So I should not recommend open office's calc. :) –  Hennes Jan 17 '13 at 17:30
1  
Well, I'd say this is a specific enough question so as not to become not constructive. I reworded it a little. It doesn't really need to be closed. –  slhck Jan 17 '13 at 20:32
    
Open the file in a spreadsheet program (Open Source ones are available) make sure it's lined up like you want, and print it. Another idea is to import the CSV into an open source SQL (like PostgreSQL) and the use PHP and JavaScript to format it/pint it. –  Everett Jan 17 '13 at 22:03
    
Actually, I've created this question after being unable to do it with Calc. At least, nothing like this in menu. Again, I need one record (=1 row) per page, vertically (as specified above). As for using PHP and SQL: yes, perhaps I'll do it like this if all else fails, however, this requires writing a program and setting up a server on a computer. I thought that maybe there is a 5 min solution. Perhaps it's too exotic problem to have a (almost) ready solution. I'll also take a look at Calc macros. –  camcam Jan 18 '13 at 18:46
    
If the answer below helped you, please mark it as accepted. –  BigHomie Jun 3 at 22:09
add comment

1 Answer 1

This can be done with Powershell:

  1. Import-Csv file

  2. for each row, construct a string

  3. Send that string to the printer using the Out-Printer cmdlet

So a script would look something like:

Import-Csv .\process.csv | foreach { "Name:$($_.Name)`nPath:$($_.Path)`nProduct:$($_.Product)" | Out-Printer}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.