Forum Discussion

AbiNyk's avatar
AbiNyk
Icon for Advocate I rankAdvocate I
2 years ago
Solved

Import Excel template to Synapse, populate and push to Teams/Sharepoint

Hi,

 

I have a Synapse workspace available where i will be querying som data. I would like to populate the data to some excel template files (stored in Teams/Sharepoint) and (re)save the file in another Teams/Sharepoint folder. 

Is it possible to import an excel file to Synapse and push the modified file to another, or is it only possible to import the DATA? 

 

If not possible, what do you suggest as the best alternative, logic apps?

 

Best regards 

8 Replies

  • frithjof_v's avatar
    frithjof_v
    Icon for Community Champion rankCommunity Champion

    Do you mean Azure Synapse Analytics or Microsoft Fabric?

     

    Does the Excel template just contain columns of data (i.e. table format, similar to a .csv) or is it more customized, i.e. similar to a form consisting of cells spread around the worksheet?

    • AbiNyk's avatar
      AbiNyk
      Icon for Advocate I rankAdvocate I

      I mean Azure Synapse Analytics .

       

      The excel template contains pictures, sheets and text and the data area is predetermined, e.g. C4- H4 and down. Probably already containing headers. I thought of interacting with the files with Python through notebooks.  

  • Hi AbiNyk,

     

    I suggest you use a Python Notebook in Synapse and use the sharepoint API to upload files to the sharepoint site.
    Here is an example of a Python script to upload an Excel file:
    https://stackoverflow.com/questions/70574450/upload-file-to-sharepoint-using-api-postman#answer-78380860

    First, you should get the right access token, preferrably with an app registration and access to the sharepoint site. This is how you receive the access token in sharepoint:
    https://stackoverflow.com/questions/75795486/how-can-i-get-an-access-token-using-msal-in-python#answer-75800949

    • GaragaRevanth's avatar
      GaragaRevanth
      Frequent Visitor

      You can post this reply:

      Thank you for your guidance! It was very helpful. I was facing the same issue, and your solution helped me resolve it successfully. I really appreciate you sharing the Python Notebook and SharePoint API approach. Thanks again!

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI AbiNyk,

    I check the documents and find current you can read data from SharePoint folder and modify these records, but it is hard to write data back to SharePoint from fabric. (it seems like fabric not able to directly integrate and manage the online SharePoint contents)

    Copy data from SharePoint Online List - Azure Data Factory & Azure Synapse | Microsoft Learn

    Set up your SharePoint folder connection - Microsoft Fabric | Microsoft Learn

    For writeback data operations, I'd like to suggest you publish them to azure side and use azure feature to push data to SharePoint side.

    Regards,

    Xiaoxin Sheng

    • AbiNyk's avatar
      AbiNyk
      Icon for Advocate I rankAdvocate I

      Its not Fabric but Azure Synapse Analytics 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi AbiNyk,

        Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

        In addition, since your requirement is more related to azure synapse analytics, you can also post this to azure forum to get better support:

        Azure Synapse Analytics - Microsoft Community Hub

        Regards,

        Xiaoxin Sheng

    • AbiNyk's avatar
      AbiNyk
      Icon for Advocate I rankAdvocate I

      What do you mean by "azure side and use azure feature " ?

       

      Would I be able to create azure function or logical apps and call them from Synapse Analytics?