This AI prompt can be used for reading an html table from an email body & convert it to JSON array. The array can further be used to store date in different data source like in online excel file, SharePoint, Dataverse etc.
Select "AI hub" from left navigation & click "AI prompts" tile:
Next, click "Create text with GPT using a prompt" tile to create a new prompt:
Enter the name as 'Convert HTML Table to JSON array' in "Prompt details" section.
Expand 'Input' section and create 3 input parameters.
Select 'JSON (preview)' in "Output" section:
Choose 'GPT (preview)' from the "Model" dropdown:
Enter the below text in the "Prompt" (left side):
Create a valid JSON array of objects to list columns from given HTML table:
Exclude property in each JSON object.
Provide valid JSON response that strictly comply with below structure:
Click 'Insert' button and add the parameter in the correct location:
Similarly, add other parameters in the prompt text:
Enter the sample values in the input parameters to test the custom prompt:
HTML Table:
<table> <tr> <th>Company</th> <th>Contact</th> <th>Country</th> </tr> <tr> <td>Alfreds Futterkiste</td> <td>Maria Anders</td> <td>Germany</td> </tr> <tr> <td>Centro comercial Moctezuma</td> <td>Francisco Chang</td> <td>Mexico</td> </tr> </table>
ExcludeColumns:
Contact
OutputStructure:
Sample data: [{"Company":"String","Contact":"String","Country":"String"}]
Click 'Test prompt' button to get the response:
[
{
"Company": "Alfreds Futterkiste",
"Country": "Germany"
},
{
"Company": "Centro comercial Moctezuma",
"Country": "Mexico"
}
]
Check out my blog to see it in action for extracting html table in email body to JSON array:
Custom AI Prompt to convert html table to JSON array (manish-solanki.com)