Excel의 피벗 테이블 및 피벗 그래프

피벗 테이블은 Microsoft Excel에 포함된 방대한 양의 데이터를 통합하는 도구입니다. 이를 통해 사용자는 수집된 데이터에서 더 빠르게 결론을 내릴 수 있습니다. 피벗 테이블은 열, 행, 페이지 및 데이터 필드로 구성되며 특정 데이터를 확장, 분리, 요약 및 그룹화하는 데 도움이 됩니다. 또한 피벗 테이블을 사용하면 방대한 양의 데이터를 가져와 소수의 데이터 필드만 볼 수 있도록 작업할 수 있습니다. 피벗 테이블의 다른 이점은 다음과 같습니다.

  • 피벗 테이블로 데이터 분석이 더 쉬워집니다
  • 피벗 테이블은 즉각적인 데이터를 생성할 수 있습니다
  • 피벗 테이블은 사용자 친화적입니다
  • 피벗 테이블은 데이터를 쉽게 요약합니다
  • 피벗 테이블은 데이터 패턴을 찾는 데 도움이 됩니다.
  • 피벗 테이블로 더 빠르게 정확한 보고서를 작성하세요
  • 피벗 테이블은 더 빠르게 결정을 내리는 데 도움이 될 수 있습니다.

Excel 파일에 피벗 테이블 추가

Aspose.Cells Cloud API는 Excel 워크시트에 피벗 테이블을 추가할 수 있는 클래스 세트를 제공합니다. PutWorksheetPivotTable 메서드를 사용하면 Excel 워크시트에 새 피벗 테이블을 추가할 수 있습니다. 테이블을 추가하려면 다음 인수를 제공해야 합니다.

  • name(문자열) - 피벗 테이블을 추가해야 하는 Excel 파일의 이름입니다.
  • sheetName(문자열) - 피벗 테이블을 추가하려는 워크시트 이름입니다.
  • sourceData(문자열) - 피벗 테이블의 데이터 소스입니다.
  • destCellName(문자열) - 피벗 테이블 보고서의 대상 범위의 왼쪽 상단 모서리에 있는 셀입니다.
  • tableName(문자열) - 새 피벗 테이블 보고서의 이름입니다.
  • useSameSource(부울) - 다른 기존 피벗 테이블에서 이 데이터 소스를 사용한 경우 동일한 데이터 소스를 사용할지 여부를 나타냅니다.

cURL 명령

curl -X PUT "https://api.aspose.cloud/v3.0/cells/Family%20Budget1.xlsx/worksheets/Sheet1/pivottables?sourceData='Current%20Month'!%24B%2427%3A%24E%2446&destCellName=B14&tableName=Pivot1&useSameSource=true" -H  "accept: application/json" -H  "authorization: Bearer <JWT Token>"

요청 URL

https://api.aspose.cloud/v3.0/cells/Family%20Budget1.xlsx/worksheets/Sheet1/pivottables?sourceData='Current%20Month'!%24B%2427%3A%24E%2446&destCellName=B14&tableName=Pivot1&useSameSource=true

C#.NET

string MyAppKey = "xxxxxxxx";    // Get AppKey from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx";   // Get AppSID from https://dashboard.aspose.cloud/

try
{
    Aspose.Cells.Cloud.SDK.Api.CellsApi cellsApi = new Aspose.Cells.Cloud.SDK.Api.CellsApi(MyAppSid, MyAppKey);
    String fileName = "Family Budget1.xlsx";
    string sheetName = "Sheet1";

    Aspose.Cells.Cloud.SDK.Model.CreatePivotTableRequest createPivotTableRequest = 
        new Aspose.Cells.Cloud.SDK.Model.CreatePivotTableRequest();
    createPivotTableRequest.Name = "NewPivot";
    createPivotTableRequest.SourceData = "'Current Month'!$B$21:$C$24";
    createPivotTableRequest.DestCellName = "G22";
    createPivotTableRequest.UseSameSource = true;
    createPivotTableRequest.PivotFieldColumns = new System.Collections.Generic.List<int?> { 1 };
    createPivotTableRequest.PivotFieldRows = new System.Collections.Generic.List<int?> { 1 };
    createPivotTableRequest.PivotFieldData = new System.Collections.Generic.List<int?> { 1 };

    Aspose.Cells.Cloud.SDK.Model.PivotTableResponse pivotTableResponse = 
        cellsApi.CellsPivotTablesPutWorksheetPivotTable(fileName, sheetName, createPivotTableRequest);

    if (pivotTableResponse != null && pivotTableResponse.Status.Equals("OK"))
    {
        Console.WriteLine("Add a Pivot Table in a Worksheet, Done!");
        Console.ReadKey();
    }
}
catch (Exception ex)
{
    System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}