Search code examples
reportnetsuite

NetSuite - Export report in csv format


I wanted to know if I can export any report into CSV format and store it in a file-cabinet folder. This needs to be happened daily automatically. I tried using plug-in implementation script for email capture. For this, I scheduled the report to send an email. but that is not getting captured. Can we create any scheduled script, read the report and create csv and save that file in file-cabinet?


Solution

  • You can use the N/task module to create a search task to save a saved search as CSV in the file cabinet.

    var searchTask = task.create({
        taskType: task.TaskType.SEARCH
    });
    searchTask.savedSearchId = searchInternalId;
    searchTask.filePath = pathToFileInCabinet;
    var taskId = searchTask.submit();