Skip to main content
alessandrot767873
July 25, 2025
Solved

Excel Date Reading Issue: Appian Interpreting "2026-07-17" as Mathematical Expression Instead of Date String

  • July 25, 2025
  • 12 replies
  • 0 views

Hello,

I'm facing a challenging issue when reading dates from Excel files using readexcelsheetpaging(). The problem occurs when Excel cells contain dates in custom format that appear as values like "2026-07-17".

The Problem: When Appian reads these date values, it interprets 2026-07-17 as a mathematical expression (2026 - 07 - 17 = 2002) instead of treating it as a date string. This happens before I can apply todate() or text() functions.

Context:

  • Excel cells contain dates with custom formatting (cannot be changed on Excel side)

  • Dates appear as format like "2026-07-17" when read by Appian

  • Need to convert these to proper Appian date values

Current Code:

a!localVariables(
  local!document: ri!document,
  local!sheetNumber: ri!sheetNumber,
  local!startIndex: ri!startIndex,
  
  local!tempResult: readexcelsheetpaging(
    excelDocument: local!document,
    sheetNumber: local!sheetNumber,
    pagingInfo: a!pagingInfo(
      startIndex: local!startIndex,
      batchSize: ri!batchSize
    ),
  ).data,
  
  local!result: a!forEach(
    items: remove(local!tempResult.values, 1),
    expression: a!forEach(
      items: fv!item,
      expression: if(fv!item = "NULL", null, fv!item)
    )
  ),
  
  a!forEach(
    items: local!result,
    expression: a!localVariables(
      local!compliance: rule!getComplianceByID(id: fv!item[12]),
      'type!{urn:com:appian:types:AD}AD_ENGAGEMENT'(
        id: null,
        fiscalYearEndDate: todate(totext(fv!item[11])),
        compliance: local!compliance,
        complianceDueDate: todate(fv!item[13]),
        inputDate: todate(fv!item[14]),
        reviewDate: todate(fv!item[15]),
        companyDeliveryDate: fv!item[18],
        electronicSubmissionDate: todate(fv!item[21]),
        receiptProcessingDate: fv!item[22],
        createdBy: "ADMIN",
        createdOn: now(),
        modifiedBy: "ADMIN",
        modifiedOn: now()
      )
    )
  )
)

What I've Tried:

  • Using todate(fv!item[index]) directly → returns null/empty

  • Using todate(totext(fv!item[index])) → still issues with mathematical interpretation

  • Various combinations of text() and todate() functions

Expected Result: Convert Excel date values like "2026-07-17" to proper Appian date objects.

Question: How can I properly handle Excel dates in custom format to prevent Appian from interpreting them as mathematical expressions? Is there a way to force Appian to treat these values as strings before applying date conversion functions?

Any insights or alternative approaches would be greatly appreciated!

Thanks in advance for your help.

Best answer by shubhama926776

You have to format data to date object manually

I added for both date and dateTime

a!map(
  date: a!localVariables(
    local!dateText: "2026-07-17",
    local!datePart: left(local!dateText, 10),
    local!temp: split(local!datePart, "-"),
    date(
      local!temp[1],
      /* year */
      local!temp[2],
      /* month */
      local!temp[3]/* day */
      
    )
  ),
  dateTime: a!localVariables(
    local!dateText: "2026-07-17 00:00:00",
    local!datePart: left(local!dateText, 10),
    local!temp: split(local!datePart, "-"),
    date(
      local!temp[1],
      /* year */
      local!temp[2],
      /* month */
      local!temp[3]/* day */
      
    )
  )
)

12 replies

harshas2775
July 25, 2025

You can refer the code below to convert date from a date stored as text - as long as you are always getting a consistent yyyy-mm-dd format from the excel.

If you have inconsistent formats then depending on format some adjustments will need to be made to retrieve the date. Hope it helps!

a!localVariables(
  local!dateText:"2026-07-11",
  local!temp:split(local!dateText,"-"),
  date(local!temp[1],local!temp[2],local!temp[3])
)

alessandrot767873
July 25, 2025

Thanks for your answer. The problem is that the Excel cell(s) is not read as Text string but as a number (e.g. 2026-07-11 = 2008 as integer and thus Appian works with the 2008 instead of the previous one with the yyyy-mm-dd format ). I can't find a workaround to that

harshas2775
July 25, 2025

oh okay! We cannot decipher date from 2008 because 2008 can be 2026-07-11 as well as 2025-11-6. We need to read the data as is from excel itself then transform if needed. 

Excel cells contain dates with custom formatting (cannot be changed on Excel side)

When you download the excel then can you see data as "2026-07-17"  ? Also as you mentioned cannot be changed on excel side, can you check the column type in excel which stores these date if its Number or General etc. 

 

shubhama926776
July 25, 2025

You have to format data to date object manually

I added for both date and dateTime

a!map(
  date: a!localVariables(
    local!dateText: "2026-07-17",
    local!datePart: left(local!dateText, 10),
    local!temp: split(local!datePart, "-"),
    date(
      local!temp[1],
      /* year */
      local!temp[2],
      /* month */
      local!temp[3]/* day */
      
    )
  ),
  dateTime: a!localVariables(
    local!dateText: "2026-07-17 00:00:00",
    local!datePart: left(local!dateText, 10),
    local!temp: split(local!datePart, "-"),
    date(
      local!temp[1],
      /* year */
      local!temp[2],
      /* month */
      local!temp[3]/* day */
      
    )
  )
)

alessandrot767873
July 25, 2025

thanks, but I cannot do that because it's not a Text format on excel. I've this excel where data is copy pasted (ignoring the cell format) and the format is custom, if I open the Excel and set the format to text, as you mentioned, I'll go from "2025-07-11" to something like 44698. So I guess my only choice is, once I've the Excel locally, find and replace the "-" element into something else so that the cell is read as text and not a math function