Hi Jorge,
Thank you for contacting Syncfusion support.
As per the Microsoft Excel behavior, it is not possible to create pivot table with only one row of data and hence the exception is thrown. So, it is recommended to have two or more rows of data to create pivot table. Please add below code as condition check to create pivot table when the rows length of used range is greater than 1.
Code Sample:
|
if (worksheet.UsedRange.Rows.Length > 1)
{
var cache = workbook.PivotCaches.Add(worksheet.UsedRange);
} |
Regards,
Abirami.