Re:Show HN: SnazzyPDF – Convert Any JSON Data to Beautifully...
by its_down_again on Thursday September 12, 2024 @08:14PM
(#41526984)
That's awesome! Mind sharing the prompt you used? I'm working on something pretty similar but a little more complex—looking to convert from an Excel sheet to Markdown or JSON.
[ Parent
| on HN ]
Re:Show HN: SnazzyPDF – Convert Any JSON Data to Beautifully...
by xupybd on Thursday September 12, 2024 @08:21PM
(#41527019)
Sure, here is the prompt.
Can you write me a program that can generate formatted PDFs from JSON? Preferably using the simplest of tools
Re:Show HN: SnazzyPDF – Convert Any JSON Data to Beautifully...
by rovr138 on Thursday September 12, 2024 @08:29PM
(#41527048)
If it was just that, I'd probably load onto a pandas df, then export the df to json. There's other ways, but this would be a simple enough way.
Check,
- https://pandas.pydata.org/pandas-docs/stable/reference/api/p...
- https://pandas.pydata.org/pandas-docs/stable/reference/api/p...
Try something like,
import pandas as pd
file_path = 'excel_file.xlsx'
df = pd.read_excel(file_path, sheet_name='WORKSHEET NAME')
df.to_json('output.json', orient='records', indent=4)