web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch() is Changing my...
Power Apps
Unanswered

Patch() is Changing my Excel Column Type

(0) ShareShare
ReportReport
Posted on by 82

All,


I have an approval process built in a PowerApp that uses the Patch() formula to add and update some values in an Excel sheet that is connected to my App via OneDrive for Business. 

 

The app previously used a Flow (or Automate) process to update the rows in Excel, but that locks out the excel sheet for up to 6 minutes, making my app throw an error for 6 minutes and essentially render it useless while the file is locked because it cannot update the data in the App. So my thought was to switch over to a Patch() function. However, what this is doing is changing my assigned Column Types in Excel from either Text, Number, or Short Date, to General, which is annoying and breaking my app and it makes it outrageously hard to manage the data and read and write to the source. 

 

This Patch() below is my initial addition of the value to the sheet. 

 

 

Set(
 RegId,
 Value(First(Sort(Cal,RegistrationID,Descending)).RegistrationID)+Value(1)
)
;
Patch(
 Cal,
 {RegistrationID: Value(RegId),
 InUse: 0,
 'Vehicle ID': ItemSelected.'Vehicle ID',
 StartDate: 'H.StartDate.RequestForm.Value'.SelectedDate,
 EndDate: 'H.EndDate.RequestForm.Value'.SelectedDate,
 Group_Project: 'H.Group/Project.RequestForm.Value'.Text,
 POC: 'H.POC.RequestForm.Value'.Text,
 Approval: 0}
);
Patch(Comm,
 {RegistrationID_Comm: RegId,
 TeamsThreadID: Value(MessageID)}
);
ResetForm('H.RequestVehicle.Form');
Set(
 RequestForm,
 false
);
Refresh(Cal);
Refresh(Comm)

 

 

And here is my "Approval" button

 

If(
 IsBlankOrError('AS.ApproverComments'.HtmlText),
 ( MicrosoftTeams.PostReplyToMessageV2(
 "Text",
 "Text",
 LookUp(
 Comm,
 Value(NeedsApproval.RegistrationID) = Value(RegistrationID_Comm),
 TeamsThreadID
 ),
 {
 content: "<p>Request Approved.</p>",
 contentType: "html"
 }
 )),
);
Patch(
 Cal,
 Filter(
 Cal,
 Value(RegistrationID) = Value(NeedsApproval.RegistrationID)
 )
 ,
 {Approval: Value(1)}
);
Refresh(Cal)

 

 

After doing this, I go to my Excel sheet and it has changed all my types to General. Is there a way to keep the Patch function from doing this or is it an Excel problem? 

 

My Data source example is below:

 

Table: Cal

Registration IDVehicle IDStart DateEnd DatePOCProjectApprovalPowerapps
IntegerTextShort DateShort DateTextText

Integer

 

Gibberish

 

Table: Comm

Registration IDTeams Thread IDPowerapps
IntegerTextGibberish

 

Thanks for any feedback. 

Note some code and Table Headers have been modified for easy readability. 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @Caz_16 ,

    Have you considered using SharePoint as a data source? Excel was not designed for concurrent use (as you have discovered). You are also Patching a number value, so I suspect Excel is simply accommodating that.

    You might have a read of this blog - it lists a few more reasons. I have only ever used Excel for static reference lists and have even stopped doing that now.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Caz_16 Profile Picture
    82 on at

    Thanks for the Reply @WarrenBelz 

     

    So SharePoint lists just left a bit of a bitter aftertaste after I initially reviewed it as a data source. However if it is going to be stable in it's operation then I suppose I don't have much of a choice. 

     

    I know my function is passing a number value (Thats what the Value() function should be doing), I just don't understand why Excel wants to change it to be a "General" column? Its formatted in Excel as an integer, why is it changing it to "General" when I provide it with an integer? 

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @Caz_16 ,

    I actually have no idea either, but Excel is not a database and this is probably just another glitch in the Power Apps interface to it.

    If you want to run on Office365 E3 Licences, SharePoint it your best option - we have run a substantial operation on it as a backend for Power Apps for a number of years with very little issues.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Caz_16 Profile Picture
    82 on at

    @WarrenBelz Obviously that's a bit frustrating of an answer, but not at you specifically, more at Microsoft. They make both these software, why can't they just play nice together? I guess Ill report my issue to Microsoft and soldier on. 

     

    Thanks for your input. Greatly appreciated. 

     

    Caz

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Thanks @Caz_16 ,

    I was just trying to point out that Excel as a dynamic data source to Power Apps just does not "play nicely" at times and I simply gave up on it when Sharepoint did things much better anyway. You get SharePoint "free" with an E3 licence. Excel "sort of" works OK for reference lists where reading is the only thing going on and can certainly perform write functions, but things like Delegation are also a problem and I have seen many posts like your with Excel issues that simply would not be a problem with SharePoint.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard