Home > Enterprise >  How to transfer a csv file from notebook folder to a datastore
How to transfer a csv file from notebook folder to a datastore

Time:09-21

I want to transfer a generated csv file test_df.csv from my Azure ML notebook folder which has a path /Users/Ankit19.Gupta/test_df.csv to a datastore which has a web path https://abc.blob.core.windows.net/azureml/LocalUpload/f3db18b6. I have written the python code as

from azureml.core import Workspace
ws = Workspace.from_config()
datastore = ws.get_default_datastore()
    
datastore.upload_files('/Users/Ankit19.Gupta/test_df.csv',
                  target_path='https://abc.blob.core.windows.net/azureml/LocalUpload/f3db18b6',
                  overwrite=True)

But it is showing the following error message:

UserErrorException: UserErrorException:
    Message: '/' does not point to a file. Please upload the file to cloud first if running in a cloud notebook.
    InnerException None
    ErrorResponse 
{
    "error": {
        "code": "UserError",
        "message": "'/' does not point to a file. Please upload the file to cloud first if running in a cloud notebook."
    }
}

I have tried enter image description here

from azureml.core import Workspace
ws = Workspace.from_config()
datastore = ws.get_default_datastore()
    
datastore.upload_files('./Users/foldername/filename.csv',
                  target_path=’your targetfolder',
                  overwrite=True)

We need to call all the parent folders before the folder. “./” is the way we can call the dataset from datastore.

  • Related