Hi folks. We're attempting to move files from our local network to our AGOL Notebook "Files" location programmatically, using ArcGIS API for Python. It looks like the arcgis.gis.nb module may be the solution, using NotebookDataAccess.
API reference here:
https://developers.arcgis.com/python/api-reference/arcgis.gis.nb.html#notebookdataaccess
In the end, I've got the Boolean to be "True" as in, it worked. However, when I go to my Notebook Files, nothing is there at "/arcgis/home".
Here's what I have so far (working in Jupyter Notebooks):
import arcgis.gis.nb
import arcgis.gis.nb._dataaccess
from arcgis.gis.nb._dataaccess import NotebookDataAccess
import arcpy
from arcgis.gis import GIS
from arcgis.gis.nb import NotebookManager, Notebook, NotebookServer, _dataaccess
gis = GIS('Home')
# URL to the desired Notebook
url = "https://levon.maps.arcgis.com/home/notebook/notebook.html?id=d693b3892c8747a892adxxxxxxxcb#"
# path to the zipfile on our network
zipfgdb = r"N:\gis\Levon\Sandbox\LIVE_TEST.zip"
# test to see if I'm actually pinging AGOL Notebook
nb_server = gis.notebook_server[0]
nb_server
# test to see if I'm accessing the correct notebook
notebook_item = gis.content.get('d693b3892c8747a892xxxxxxxxx30cb')
notebook_item
# attempt to upload the zipfile from our network to Notebook /arcgis/home Files
st_up = NotebookDataAccess(url, gis)
st_up.upload(zipfgdb)
Result: "True"
So, it's saying True, as in it worked, but when I check, nothing is there. See below. Any help!? Be nice, I'm a intermediate/beginner! 🙂 We've been working on this for days, this is the closest we've gotten.