How to Convert an Excel file to JSON in C/C++

While Excel files may be the go-to format for data management and organization, you can run into some issues in preserving the original function and quality of the data when attempting to transfer it to a web application. To avoid problems like these from delaying or injuring your goals, you can automatically convert an Excel file to the more online-friendly JSON format by using the following API in C/C++.

To use this API, we first need to install libcurl into your project:


Following the installation, we can call the Excel to JSON conversion function:

CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: multipart/form-data");
headers = curl_slist_append(headers, "Apikey: YOUR-API-KEY-HERE");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_mime *mime;
curl_mimepart *part;
mime = curl_mime_init(curl);
part = curl_mime_addpart(mime);
curl_mime_name(part, "inputFile");
curl_mime_filedata(part, "/path/to/file");
curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
res = curl_easy_perform(curl);

With this simple operation, you can optimize a spreadsheet for any web-based application or project. Visit the Cloudmersive website to retrieve your free API key; this will give you access to 800 monthly calls across our multitude of APIs.