Convert only first sheet to pdf

I have a Excel Workbook with about 20-30 data sheets and one pretty report sheet. I only want the first sheet to be converted to pdf how would i do this with the cloud solution?

Currently, it is not supported to convert only the first worksheet. You can try to hide the other worksheets that do not need to be converted to pdf. When converting, only the contents of the unhidden worksheets will be output.

@dzauner ,

Please refer to the following code to implement your needs:

        CellsApi cellsApi = new CellsApi(Environment.GetEnvironmentVariable("CellsCloudClientId"), Environment.GetEnvironmentVariable("CellsCloudClientSecret"));
        string filePath = @"input.xlsx";

        UploadFileRequest uploadFileRequest = new UploadFileRequest();
        uploadFileRequest.UploadFiles = new Dictionary<string, Stream>();
        uploadFileRequest.UploadFiles.Add("input.xlsx", File.OpenRead(filePath));
        uploadFileRequest.path = "TestData\\input.xlsx";
        cellsApi.UploadFile(uploadFileRequest);

        PutChangeVisibilityWorksheetRequest putChangeVisibilityWorksheetRequest = new PutChangeVisibilityWorksheetRequest();
        putChangeVisibilityWorksheetRequest.sheetName = "Sheet2";
        putChangeVisibilityWorksheetRequest.isVisible= false;
        putChangeVisibilityWorksheetRequest.name = "input.xlsx";
        putChangeVisibilityWorksheetRequest.folder = "TestData";

        cellsApi.PutChangeVisibilityWorksheet(putChangeVisibilityWorksheetRequest);

        PostWorkbookSaveAsRequest postWorkbookSaveAsRequest = new PostWorkbookSaveAsRequest();
        postWorkbookSaveAsRequest.name = "input.xlsx";
        postWorkbookSaveAsRequest.folder = "TestData";
        postWorkbookSaveAsRequest.newfilename = "input_xlsx.pdf";
        cellsApi.PostWorkbookSaveAs(postWorkbookSaveAsRequest);

        DownloadFileRequest downloadFileRequest = new DownloadFileRequest();
        downloadFileRequest.path = "input_xlsx.pdf";
        using (Stream stream = cellsApi.DownloadFile(downloadFileRequest))
        {
            using (Stream downloadFile = File.OpenWrite("input_xlsx.pdf"))
            {
                stream.CopyTo(downloadFile);
                stream.Close();
                downloadFile.Close();
            }
        }

@dzauner ,

You can also try one of two ways to achieve your needs, and try the following code:

        CellsApi cellsApi = new CellsApi(Environment.GetEnvironmentVariable("CellsCloudClientId"), Environment.GetEnvironmentVariable("CellsCloudClientSecret"));
        string filePath = @"BookChart.xlsx";
        UploadFileRequest uploadFileRequest = new UploadFileRequest();
        uploadFileRequest.UploadFiles = new Dictionary<string, Stream>();
        uploadFileRequest.UploadFiles.Add("BookChart.xlsx", File.OpenRead(filePath));
        uploadFileRequest.path = "TestData\\BookChart.xlsx";
        cellsApi.UploadFile(uploadFileRequest);
        GetWorksheetWithFormatRequest worksheetWithFormatRequest = new GetWorksheetWithFormatRequest();
        worksheetWithFormatRequest.folder = "TestData";
        worksheetWithFormatRequest.name = "BookChart.xlsx";
        worksheetWithFormatRequest.sheetName = "Sheet1";
        worksheetWithFormatRequest.format = "PDF";
        using (Stream stream = cellsApi.GetWorksheetWithFormat(worksheetWithFormatRequest))
        {
            using (Stream downloadFile = File.OpenWrite("GetOneSheetWithPDF.pdf"))
            {
                stream.CopyTo(downloadFile);
                stream. Close();
                downloadFile.Close();
            }
        }

@dzauner
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSCLOUD-12932

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.