* Formatted PDF from CSV data
@ 2022-09-27 21:06 Gianluca Carbone
[not found] ` <7db8040f-dd62-416f-a3d7-a88c1e257d9en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Gianluca Carbone @ 2022-09-27 21:06 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 970 bytes --]
Hi everyone,
I try to create a Structured PDF (Title, headers, dates, and other stuff)
starting from a CSV file which contain an header and responses. This CSV
was generated by a Google Forms Questions and Answer, and starting from
that one I want to create a simple formatted document.
Anyone have some ideas on which characteristcs of pandoc can I use to
obtain this results?
As example, i share with you some screen of the desidered results
CSV file:
[image: example1.png]
PDF (output) file
[image: example2.png]
Thank you so much for your help!
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7db8040f-dd62-416f-a3d7-a88c1e257d9en%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 1552 bytes --]
[-- Attachment #2: example2.png --]
[-- Type: image/png, Size: 35434 bytes --]
[-- Attachment #3: example1.png --]
[-- Type: image/png, Size: 4996 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Formatted PDF from CSV data
[not found] ` <7db8040f-dd62-416f-a3d7-a88c1e257d9en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-09-28 0:59 ` Martin Hepp
2022-09-28 10:38 ` Thomas Chevrier
1 sibling, 0 replies; 5+ messages in thread
From: Martin Hepp @ 2022-09-28 0:59 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 1704 bytes --]
I would read the CSV in Python, print/write basic Markdown from there to a file, and then use Pandoc for producing a PDF.
It’s probably 5-10 lines of Python code.
Best wishes
Martin
> On 27. Sep 2022, at 23:07, Gianluca Carbone <gianlucarbone96-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Hi everyone,
>
> I try to create a Structured PDF (Title, headers, dates, and other stuff) starting from a CSV file which contain an header and responses. This CSV was generated by a Google Forms Questions and Answer, and starting from that one I want to create a simple formatted document.
>
> Anyone have some ideas on which characteristcs of pandoc can I use to obtain this results?
>
> As example, i share with you some screen of the desidered results
>
> CSV file:
>
> PDF (output) file
>
>
> Thank you so much for your help!
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7db8040f-dd62-416f-a3d7-a88c1e257d9en%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8C6563EB-32FD-4BD8-9D14-96894855FF1C%40gmail.com.
[-- Attachment #2.1: Type: text/html, Size: 3116 bytes --]
[-- Attachment #2.2: example1.png --]
[-- Type: image/png, Size: 4996 bytes --]
[-- Attachment #2.3: example2.png --]
[-- Type: image/png, Size: 35434 bytes --]
[-- Attachment #2.4: example2.png --]
[-- Type: image/png, Size: 35434 bytes --]
[-- Attachment #2.5: example1.png --]
[-- Type: image/png, Size: 4996 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Formatted PDF from CSV data
[not found] ` <7db8040f-dd62-416f-a3d7-a88c1e257d9en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-09-28 0:59 ` Martin Hepp
@ 2022-09-28 10:38 ` Thomas Chevrier
[not found] ` <0df46ea0-a6a6-4abc-a6df-2e48fe895fb2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Chevrier @ 2022-09-28 10:38 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 1344 bytes --]
https://stackoverflow.com/questions/71224773/dynamically-set-r-markdown-title-output-filename-and-global-variables
could this be of any help to what you are trying to achieve or am I
misreading your issue? Apologies if so.
On Wednesday, September 28, 2022 at 6:06:57 AM UTC+9 gianluc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
wrote:
> Hi everyone,
>
> I try to create a Structured PDF (Title, headers, dates, and other stuff)
> starting from a CSV file which contain an header and responses. This CSV
> was generated by a Google Forms Questions and Answer, and starting from
> that one I want to create a simple formatted document.
>
> Anyone have some ideas on which characteristcs of pandoc can I use to
> obtain this results?
>
> As example, i share with you some screen of the desidered results
>
> CSV file:
> [image: example1.png]
> PDF (output) file
> [image: example2.png]
>
> Thank you so much for your help!
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/0df46ea0-a6a6-4abc-a6df-2e48fe895fb2n%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 2308 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Formatted PDF from CSV data
[not found] ` <0df46ea0-a6a6-4abc-a6df-2e48fe895fb2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-09-29 16:53 ` Martin Hepp
[not found] ` <51C50E26-9499-4EDB-8E59-82877AB3B2CF-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Martin Hepp @ 2022-09-29 16:53 UTC (permalink / raw)
To: pandoc-discuss via
As my last post might have been too brief to be actually helpful, here is a complete example:
1. Python Script
================
# csv2md.py
# Run with
# python csv2md.py > markdown_file.md
import csv
# Read from file and return dict with keys from first line in CSV
with open('data/performance_review.csv', newline='') as csvfile:
reader = csv.DictReader(csvfile)
# Convert to a list so that we can access it multiple times
reader = list(reader)
print("# Employee Assessment Report")
print()
print("This report contains assessments for the following staff members:")
print()
for row in reader:
print(f"- {row.get('name', '[Name missing]')}")
print()
for row in reader:
print(f"# Employee: {row.get('name', '[Name missing]')}")
print()
print(f"## Job Position: {row.get('position', 'N/A')}")
print()
print(f"{row.get('job_description', 'No detailed description available.')}")
print()
print(f"## Assessment")
print()
print(f"**Overall Performance:** {row.get('rating', 'N/A')} of 5")
print()
print(f"{row.get('review', 'No detailed review available.')}")
2. Example File data/performance_review.csv
===========================================
name, position, job_description, rating, review
Joe Miller, Developer, "Python back-end", 4, "Hard-working and diligent"
Paula Mayer, CIO, "Overall IT responsibility", 4, "Effective and motivating"
3. Output markdown_file.md
==========================
# Employee Assessment Report
This report contains assessments for the following staff members:
- Joe Miller
- Paula Mayer
# Employee: Joe Miller
## Job Position: N/A
No detailed description available.
## Assessment
**Overall Performance:** N/A of 5
No detailed review available.
# Employee: Paula Mayer
## Job Position: N/A
No detailed description available.
## Assessment
**Overall Performance:** N/A of 5
No detailed review available.
4. Rendering
============
You can then use any Pandoc workflow you like to convert that into PDF, MS Word, etc.
If the data is a bit more complex, I would parse into a Pandas DataFrame and process the data in there, like so
df = pd.read_csv('data/performance_review.csv')
Hope that helps!
Best wishes
Martin
Resources:
=========
- https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
- https://docs.python.org/3/library/csv.html
-----------------------------------
martin hepp https://www.heppnetz.de
mfhepp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> On 28. Sep 2022, at 12:38, Thomas Chevrier <tchevri-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> https://stackoverflow.com/questions/71224773/dynamically-set-r-markdown-title-output-filename-and-global-variables
>
> could this be of any help to what you are trying to achieve or am I misreading your issue? Apologies if so.
>
> On Wednesday, September 28, 2022 at 6:06:57 AM UTC+9 gianluc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> Hi everyone,
>
> I try to create a Structured PDF (Title, headers, dates, and other stuff) starting from a CSV file which contain an header and responses. This CSV was generated by a Google Forms Questions and Answer, and starting from that one I want to create a simple formatted document.
>
> Anyone have some ideas on which characteristcs of pandoc can I use to obtain this results?
>
> As example, i share with you some screen of the desidered results
>
> CSV file:
>
> PDF (output) file
>
>
> Thank you so much for your help!
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/0df46ea0-a6a6-4abc-a6df-2e48fe895fb2n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/51C50E26-9499-4EDB-8E59-82877AB3B2CF%40gmail.com.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Formatted PDF from CSV data
[not found] ` <51C50E26-9499-4EDB-8E59-82877AB3B2CF-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-10-12 10:11 ` Gianluca Carbone
0 siblings, 0 replies; 5+ messages in thread
From: Gianluca Carbone @ 2022-10-12 10:11 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 4839 bytes --]
Thank you so much guys I try to implement it! <3
Il giorno giovedì 29 settembre 2022 alle 18:53:29 UTC+2 mfhepp ha scritto:
> As my last post might have been too brief to be actually helpful, here is
> a complete example:
>
> 1. Python Script
> ================
>
> # csv2md.py
> # Run with
> # python csv2md.py > markdown_file.md
>
> import csv
>
> # Read from file and return dict with keys from first line in CSV
> with open('data/performance_review.csv', newline='') as csvfile:
> reader = csv.DictReader(csvfile)
> # Convert to a list so that we can access it multiple times
> reader = list(reader)
>
> print("# Employee Assessment Report")
> print()
> print("This report contains assessments for the following staff members:")
> print()
> for row in reader:
> print(f"- {row.get('name', '[Name missing]')}")
> print()
>
> for row in reader:
> print(f"# Employee: {row.get('name', '[Name missing]')}")
> print()
> print(f"## Job Position: {row.get('position', 'N/A')}")
> print()
> print(f"{row.get('job_description', 'No detailed description
> available.')}")
> print()
> print(f"## Assessment")
> print()
> print(f"**Overall Performance:** {row.get('rating', 'N/A')} of 5")
> print()
> print(f"{row.get('review', 'No detailed review available.')}")
>
> 2. Example File data/performance_review.csv
> ===========================================
>
> name, position, job_description, rating, review
> Joe Miller, Developer, "Python back-end", 4, "Hard-working and diligent"
> Paula Mayer, CIO, "Overall IT responsibility", 4, "Effective and
> motivating"
>
> 3. Output markdown_file.md
> ==========================
>
> # Employee Assessment Report
>
> This report contains assessments for the following staff members:
>
> - Joe Miller
> - Paula Mayer
>
> # Employee: Joe Miller
>
> ## Job Position: N/A
>
> No detailed description available.
>
> ## Assessment
>
> **Overall Performance:** N/A of 5
>
> No detailed review available.
> # Employee: Paula Mayer
>
> ## Job Position: N/A
>
> No detailed description available.
>
> ## Assessment
>
> **Overall Performance:** N/A of 5
>
> No detailed review available.
>
> 4. Rendering
> ============
>
> You can then use any Pandoc workflow you like to convert that into PDF, MS
> Word, etc.
>
> If the data is a bit more complex, I would parse into a Pandas DataFrame
> and process the data in there, like so
>
> df = pd.read_csv('data/performance_review.csv')
>
>
> Hope that helps!
>
> Best wishes
> Martin
>
>
> Resources:
> =========
>
> - https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
> - https://docs.python.org/3/library/csv.html
>
>
> -----------------------------------
> martin hepp https://www.heppnetz.de
> mfh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>
>
>
>
>
>
>
>
>
>
>
> > On 28. Sep 2022, at 12:38, Thomas Chevrier <tch...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> >
> https://stackoverflow.com/questions/71224773/dynamically-set-r-markdown-title-output-filename-and-global-variables
> >
> > could this be of any help to what you are trying to achieve or am I
> misreading your issue? Apologies if so.
> >
> > On Wednesday, September 28, 2022 at 6:06:57 AM UTC+9
> gianluc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> > Hi everyone,
> >
> > I try to create a Structured PDF (Title, headers, dates, and other
> stuff) starting from a CSV file which contain an header and responses. This
> CSV was generated by a Google Forms Questions and Answer, and starting from
> that one I want to create a simple formatted document.
> >
> > Anyone have some ideas on which characteristcs of pandoc can I use to
> obtain this results?
> >
> > As example, i share with you some screen of the desidered results
> >
> > CSV file:
> >
> > PDF (output) file
> >
> >
> > Thank you so much for your help!
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/0df46ea0-a6a6-4abc-a6df-2e48fe895fb2n%40googlegroups.com
> .
>
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1a763402-668c-42e6-907a-761d04f6f0b9n%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 7819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-12 10:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27 21:06 Formatted PDF from CSV data Gianluca Carbone
[not found] ` <7db8040f-dd62-416f-a3d7-a88c1e257d9en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-09-28 0:59 ` Martin Hepp
2022-09-28 10:38 ` Thomas Chevrier
[not found] ` <0df46ea0-a6a6-4abc-a6df-2e48fe895fb2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-09-29 16:53 ` Martin Hepp
[not found] ` <51C50E26-9499-4EDB-8E59-82877AB3B2CF-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-10-12 10:11 ` Gianluca Carbone
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).