Hi @CU05020837-0,
Let's find out how Excel behaves in conjunction with Power Apps - particularly for the date field, Excel expects either a properly formatted ISO 8601 datetime string or a true blank value, but Power Apps sometimes sends an empty string which Excel cannot parse, causing the RFC 3339 error.
We need to convert empty or blank date/time inputs to Blank() or null in a way so that PA sends a proper blank value, no, not a string which is empty!
So, to handle an optional DateTime field from Excel in Power Apps without causing RFC 3339 format errors, we can conditionally format and submit the value only if the user has selected a date.
I believe this approach for patch or form update formula will help:
If(
IsBlank(DatePicker1.SelectedDate),
Blank(), // We are sending a true blank to Excel
Text(
DateAdd(
DatePicker1.SelectedDate,
Value(DropdownHour.Selected.Value),
TimeUnit.Hours
) + Time(
0,
Value(DropdownMinute.Selected.Value),
0
),
"yyyy-mm-ddThh:mm:ss"
)
)
Note: if you go for a Patch function, the following snippet will help:
Patch(
xlTable,
Defaults(xlTable),
{
DateTimeColumn: Text(
DateAdd(
DatePicker1.SelectedDate,
Value(DropdownHour.Selected.Value),
TimeUnit.Hours
) + Time(
0,
Value(DropdownMinute.Selected.Value),
0
),
"yyyy-mm-ddThh:mm:ss"
)
}
)
Please let me know if these approaches help or not.
I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!