Place XSTRING ( Excel ) into Sharepoint using REST

Srikanth 21 Reputation points
2022-07-19T06:22:20.947+00:00

Hi All,

I am working on uploading the .xlsx file in Sharepoint using REST services. We have data in XSTRING format, i am getting an 'Bad Request' error if i try to send the request.
Is there a way we can send the excel file in XSTRING format. Appreciate your help.

Thank you

Microsoft 365 and Office SharePoint Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2022-07-21T08:48:44.203+00:00

    Hi @Srikanth ,
    Per my test, you can use following url to upload a file to sharepoint.
    https://xxx.sharepoint.com/sites/aaa/_api/web/GetFolderByServerRelativeUrl('/sites/aaa/Document/')/Files/add(url='test.xlsx',overwrite=true)
    223045-image.png

    You can also refer to following code to upload a file by rest api
    https://www.c-sharpcorner.com/blogs/upload-documents-show-documents-in-a-page-using-sharepoint-rest-api


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.