What i found is when you use the "Grant Access" action in PowerAutomate is that the permison level is not exactly like the permison in SharePoint,So i hade to use anothr level of permisons for the doucment to work, but because the Grant Access have only two options which are: View and Edit. I hade to use a custom one so i user the
role:1073741828
so people can view the files
these are the diffrent code for each level