'Accessing a sharepoint xlsx programmatically through R

I am currently trying to access a xlsx file present in company sharepoint drive

URL - https://xxxx.sharepoint.com/:x:/r/sites/cqa/xxxx/_layouts/15/doc2.aspx?sourcedoc=%7BFxxx390-B71D-4C71-B252-6E3DCA8E9FDA%7D&file=Updated%20LXXal%20Reqxxxxents%20for%20XXXXX%20XXXX%20Actixxxx.xlsx&action=default&mobileredirect=true&cid=0abe8bcd-c785-4c14-a9f3-263e8e806aa6

I read multiple links but none of them seem to work. Tried using httr::GET

require(httr)
url <- "above url"
r <- GET(url, authenticate("[email protected]","password"))

But getting the below error response:

  Date: 2022-04-08 13:07
  Status: 403
  Content-Type: text/plain; charset=utf-8
  Size: 13 B

Tried using Microsoft365R::get_sharepoint_site("above url") but it shows "Need admin approval".

Is there any other direct way to read the file through R in a dataframe. Any suggestion would help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source