Hi Can anyone share the procedure/code to load csv...
# general
y
Hi Can anyone share the procedure/code to load csv for saved imports from backend?
t
y
Thanks, I will check it
d
not sure if you need more info, but you'd need to
task.create
to then import that csv file via a saved CSV import
y
I tried to create the below code, but I am getting error: <# Set up the SuiteTalk REST API base URL base_url = f'https://{account_id}.suitetalk.api.netsuite.com/services/rest/record/v1' # Set up the headers for API requests headers = { 'prefer': 'transient', 'Content-Type': 'application/json', 'Cookie': 'NS_ROUTING_VERSION=LAGGING' } # Read the CSV file and encode it as a Base64 string csv_file_path = '/Users/yogi/Downloads/Vendors/sample/sample_vendor_ns.csv' with open(csv_file_path, 'rb') as file: csv_data_base64 = base64.b64encode(file.read()).decode() # Create a new CSV import job csv_import_job = { 'recordType': 'Vendors', # Set the target record type, e.g., 'customer' 'mappingId': '431', # Set the internal ID of your saved CSV import, if applicable 'csvFile': csv_data_base64, # Set the Base64-encoded CSV data } response = requests.post(f'{base_url}/csvimport', auth=oauth, headers=headers, data=json.dumps(csv_import_job)) if response.status_code == 201: job_id = response.json()['id'] print(f'CSV import job created with ID: {job_id}') else: print('Failed to create CSV import job:', response.text)>
n
Your original request reads that you want to process a CSV from the backend. In other words you lead people to think you wanted to write script, in NetSuite, to process a CSV file. Looking at your code I'm not clear what you're trying to do but it looks like you want to send a CSV file to NetSuite, and potentially process it?