A way with Excel Interop (test with a random .xls with Office 2016 on Windows10 21H1):
Excel::_ApplicationPtr pExcel(__uuidof(Excel::Application));
pExcel->Workbooks->Open(L"E:\\employees.xls");
// To test
// pExcel->PutVisible(0, TRUE);
Excel::_WorksheetPtr pWorkSheet = pExcel->ActiveSheet;
Excel::RangePtr pRange = pWorkSheet->Cells;
// Read value
_variant_t va = pRange->Item[2][1];
_bstr_t bstrText1(va);
TCHAR wsValue[255];
wcsncpy_s(wsValue, _countof(wsValue), static_cast<wchar_t const*>(bstrText1), _TRUNCATE);
TCHAR wsBuffer[512];
wsprintf(wsBuffer, TEXT("Cell value (A,2) : %s\r\n"), wsValue);
OutputDebugString(wsBuffer);
// Write value
pRange->Item[2][1] = L"Test";
// Read new value
va = pRange->Item[2][1];
_bstr_t bstrText2(va);
wcsncpy_s(wsValue, _countof(wsValue), static_cast<wchar_t const*>(bstrText2), _TRUNCATE);
wsprintf(wsBuffer, TEXT("Cell new value (A,2) : %s\r\n"), wsValue);
OutputDebugString(wsBuffer);
// To avoid "Want to save your changes" Dialog Box
pExcel->PutDisplayAlerts(LOCALE_USER_DEFAULT, VARIANT_FALSE);
pExcel->Quit();
At beginning :
#import "C:\Program Files (x86)\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\OFFICE16\mso.dll" rename("RGB", "MSRGB") rename("DocumentProperties", "WordDocumentProperties")
#import "C:\Program Files (x86)\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB" raw_interfaces_only, rename("Reference", "ignorethis"), rename("VBE", "testVBE")
#import "C:\Program Files (x86)\Microsoft Office\root\Office16\Excel.exe" exclude("IFont", "IPicture") rename("RGB", "ignorethis"), rename("DialogBox", "ignorethis"), rename("VBE", "testVBE"), rename("ReplaceText", "EReplaceText"), rename("CopyFile","ECopyFile"), rename("FindText", "EFindText"), rename("NoPrompt", "ENoPrompt")