Automated Backups - SharePoint

Hello team,

I have scheduled weekly backup in Smartsheet and I was wondering if it is possible to have the backup file automatically moved to a SharePoint folder.

At the moment I need to download the file every week and and upload it to SharePoint.

I am hopping that there is a way to automate this process.

Thank You.

Answers

  • Andrée Starå
    Andrée Starå ✭✭✭✭✭✭
    edited 02/03/24

    Hi @Emskie321

    I hope you're well and safe!

    It's probably possible, but you need a solution that collects the download link from the email, downloads it, and then uploads it to Sharepoint.

    I hope that helps!

    Be safe, and have a fantastic weekend!

    Best,

    Andrée Starå | Workflow Consultant / CEO @ WORK BOLD

    Did my post(s) help or answer your question or solve your problem? Please support the Community by marking it Insightful/Vote Up, Awesome, or/and as the accepted answer. It will make it easier for others to find a solution or help to answer!

    SMARTSHEET EXPERT CONSULTANT & PARTNER

    Andrée Starå | Workflow Consultant / CEO @ WORK BOLD

    W: www.workbold.com | E:andree@workbold.com | P: +46 (0) - 72 - 510 99 35

    Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.

  • marc4
    marc4 ✭✭✭✭

    We use Zapier for this. Have a rule that forwards the emails from Smartsheet to Zapier. Zapier can extract the url from the message, retrieve the file and save it. We save it to Google Drive, but you could save it anywhere.

    You could also do this with PowerAutomate.

    We used Zapier because it was free and fast to implement.

    /marc

  • Lee Joramo
    Lee Joramo ✭✭✭✭✭✭

    Several suggestions:

    1. Zapier and similar third-party services are the easiest way for the non-programmer/non-system admin
    2. If you have a Smartsheet Team or Enterprise account, I would look into using Smartsheet's backup tool. This will allow you more flexibility to schedule what, when, and where to save the backup files. https://github.com/smartsheet-platform/backup-java
    3. In the 1990's -- before web API's became common -- email was often the primary way to exchanged data between computer systems. It is easy to write a python, perl, or your language of choice to grab emails and their attachments and do what ever you want. To this day I maintain several operations that make use of this. While this does need a computer you control to run the code, you are not dependent on a third-party service.

    As an example of option 3, I asked ChatGPT: "Using python, login to a POP mail box and down load all *.ZIP file attachments sent from "test@example.com" and save the files to the directory /myComputer/myfiles/". Here is the code it generated.

    import os
    import poplib
    from email import parser
    from email.policy import default
    
    # POP3 server details
    pop_server = 'your_pop_server'
    pop_port = 995  # Change this if your POP3 server uses a different port
    pop_user = 'your_email@example.com'
    pop_password = 'your_password'
    
    # Sender and directory details
    sender_email = 'test@example.com'
    download_directory = '/myComputer/myfiles/'
    
    def download_attachments(msg):
        for part in msg.iter_attachments():
            if part.get_content_type() == 'application/zip':
                filename = part.get_filename()
                file_path = os.path.join(download_directory, filename)
    
                with open(file_path, 'wb') as file:
                    file.write(part.get_payload(decode=True))
                print(f"Downloaded: {filename}")
    
    def main():
        # Connect to POP3 server
        pop_conn = poplib.POP3_SSL(pop_server, pop_port)
        pop_conn.user(pop_user)
        pop_conn.pass_(pop_password)
    
        # Get the total number of messages in the mailbox
        num_messages = len(pop_conn.list()[1])
    
        # Retrieve and process each message
        for i in range(num_messages):
            # Retrieve the email message
            _, msg_data, _ = pop_conn.retr(i + 1)
            msg_text = b'\r\n'.join(msg_data).decode('utf-8')
    
            # Parse the email message
            msg = parser.BytesParser(policy=default).parsebytes(msg_text)
    
            # Check if the sender matches the specified email
            if sender_email in msg.get_all('from', []):
                download_attachments(msg)
    
        # Close the connection
        pop_conn.quit()
    
    if __name__ == "__main__":
        main()
    

    I have not run this code... you would want to closely review and test the above code.

    ... the above looks about like what I have written many times over the years. My code is typically far more complex to deal with copying data into a database, or other actions. But the basics of fetching email attachments and saving them is pretty simple.