I have some saved searches that I stored in files in the file cabinet and I would like to programmatically download these files but I run into Netsuite’s 10mb file size limitation. I have scoured the suitescript documentation but nothing jumps out to me as a solution. Is there some way to do this?
We recently downloaded a few million files from Netsuite. We didn't use SuiteScript, due to the limitations (like you describe) and the cost. If that isn't a requirement, you can use the Python SDK (Uses the SOAP API) for Netsuite. We were regularly pulling files >50 MB with code similar to this:
from netsuitesdk import NetSuiteConnection
import logging
def connect() -> NetSuiteConnection:
token = oauth.Token(key=TOKEN_KEY, secret=TOKEN_SECRET)
consumer = oauth.Consumer(key=CONSUMER_KEY, secret=CONSUMER_SECRET)
NS_ACCOUNT = NETSUITE_ACCOUNT
NS_CONSUMER_KEY = consumer.key
NS_CONSUMER_SECRET = consumer.secret
NS_TOKEN_KEY = token.key
NS_TOKEN_SECRET = token.secret
nc = NetSuiteConnection(
account=NS_ACCOUNT,
consumer_key=NS_CONSUMER_KEY,
consumer_secret=NS_CONSUMER_SECRET,
token_key=NS_TOKEN_KEY,
token_secret=NS_TOKEN_SECRET,
caching_path="./netsuite_cache/",
)
logging.warn("Connected to NetSuite")
return nc
def download_file(nc: NetSuiteConnection, file_id: str) -> bytes:
logging.warn(f"Getting file content for ID {file_id}")
file = nc.files.get(internalId=file_id)
return file.content
To use this code, you need to have the file ID you want to download. However, you can easily get this list from NetSuite (either with the SOAP API or through a manual export in the UI).
NOTE: You will need to get the details for TOKEN_KEY
, TOKEN_SECRET
, CONSUMER_KEY
, CONSUMER_SECRET
, and NETSUITE_ACCOUNT
from your NetSuite administrator. See the oracle docs for more details on how to generate these.