I tested the following code in 2020b with a file I made with a column with date, and first tow as long name, and it imported correctly by setting column as date
#include <oExtFile.h>
void impxls(string strFile, bool bHeading = true, int nSheet = 0, bool bCellStyles = false)
{
vector<string> vsSheets;
int nn = get_excel_sheet_names(strFile, &vsSheets);
if(nn <= 0) {
out_str("not a valid Excel file");
return;
}
Worksheet wks = Project.ActiveLayer();
ExcelImportOptions stR;
stR.xlsctrl.m_dwRXC = RXC_RESET_FORMAT | RXC_VALUE | RXC_VALUE_FORMAT | RXC_AUTO_RENAME_SHEET;
if(bCellStyles)
stR.xlsctrl.m_dwRXC |= RXC_STYLE;
if(bHeading) {
stR.header.SubHeaderLines = -1;
stR.header.LongName = 1;
}
int nC2=-1;//to receive output actual last column
//destination columns
stR.xlsctrl.m_nStartColIndex = 0;
stR.xlsctrl.m_pnLastColIndex = &nC2;
int nErr = wks.ImportExcel(strFile, nSheet, &stR, true);
if(nErr != 0)
out_int("failed: ", nErr);
}
LT to call it
dlgfile g:=*.xlsx;impxls fname$;
CP