Convert / Export Microsoft Excel SpreadSheet to image using Aspose.Cells REST API

I’m trying to export a worksheet as png or jpg using the C# SDK.
Unfortunately the method GetWorkSheetWithFormat referenced in the documentation https://docs.aspose.cloud/cells/tr/worksheets/conversion/ doesn’t exist.
I tried
var apiResponse = cellsApi.CellsWorksheetsGetWorksheet(@“Anhang.xlsx”, “VMP V1.0”, 128, 128);
but this gives me a JSON.
Thank you

@jojogeyer

Thank you for contacting Aspose Support.

format parameter is missing in the CellsWorksheetsGetWorksheet API of our revamped .NET SDK. We are working to fix this issue at the earliest (CELLSCLOUD-10156).

Meanwhile just to show how the API should look like I have written the following cURL example:

// First get Access Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/oauth2/token" \
-X POST \
-d 'grant_type=client_credentials&client_id=0B17F60A-6D69-426B-9ABD-79F35A6E9F7B&client_secret=53b8b19adffa41a3e87dbbd8858977ae' \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
 
// cURL example to convert Worksheet to Image 
curl -v "https://api.aspose.cloud/v1.1/cells/test_cells.xlsx/worksheets/Sheet1?format=gif" \
-X GET \
-H "Content-Type: application/json" \
-H "Accept: multipart/form-data" \
-H "Authorization: Bearer E69aetfC9JqHo-aXX823s1FwFXpMzgpEjtvV82tqU-pvg0hZnOtyaEHVCSa5fjbCCjvth0ArFUn-q0LQjvlV1RinyKXIE7ydAoDQhUYw6refUm9IaiNXPr6CcPAAee-r98BcTCOwywkOfrW_9VqXDKt-ypoFbXLL86emx4W-YVS9_M2GA_LlFAMLVc68IN8bLlX6gY84TiHUsn0Ry5DlcZpEhU4fRL6DTbOoGnJskvCSHxnTWH0s92gfBmAmV4KalB--Jjd4lgqEc8OkwbVkLHL_qpe4pO39y521IsL8In4fQjnaVdNSYIQJSRHMr18DxEq20rde7_wT0tuD03lPMdK8MTLno9RSPswYgzaZa5jsO1tsGIwoykgbXWbaP49AW-ht7_1HeXUMPiCVbnSOPs71jRtWpaw35Qb29LIwQmiqP7P-iq8BkP20xQ59hyU0bNSUJMch8Euxo_Lm6B1ySSrS1kdyxFGRWLdWhtS61GKjaD7d" \
-o Sheet1.gif

Input File: test_cells.xlsx.zip (873.6 KB)
Output File: Sheet1.gif (58.6 KB)

The supported image formats are:

  • jpeg
  • png
  • emf
  • bmp
  • gif

@jojogeyer

Thanks for your patience. We have already fixed your above reported issue and included format parameter in GetWorkSheetWithFormat API method. Please check C# sample code for your reference.

string name = "Book1.xlsx";
string sheetName = "Sheet1";
string format = "png";
string folder = "Temp";
var response = cellsAPI.CellsWorksheetsGetWorksheet(name, sheetName, format, null, null, null, null, folder);