Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Marketplace Contribution] Common Scripts - Content Pack Update #35297

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Packs/CommonScripts/ReleaseNotes/1_15_24.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#### Scripts

##### SetGridField
##### ExportToCSV

- Updated the Docker image to: *demisto/pandas:1.0.0.102566*.
- %%Updated the script to handle the issue of encoding non english characters while loading the CSV file in the Microsoft excel sheet. Added a new argument 'codec' to choose between UTF-8 and UTF-16-BOM%%
4 changes: 4 additions & 0 deletions Packs/CommonScripts/Scripts/ExportToCSV/ExportToCSV.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ if (args.headers && !Array.isArray(args.headers)){
}

var csvString = convertToCSV(args.csvArray, args.headers);
if (args.codec === 'UTF-16-BOM') {
var utf16Bom = '\uFEFF';
csvString = utf16Bom + csvString;
}
var createdFileID = saveFile(csvString);

return {
Expand Down
21 changes: 18 additions & 3 deletions Packs/CommonScripts/Scripts/ExportToCSV/ExportToCSV.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,34 @@ type: javascript
tags:
- Utility
- csv
comment: Export given array to csv file
comment: Export given array to csv file.
enabled: true
args:
- name: fileName
required: true
default: true
description: output filename
description: output filename.
- name: csvArray
required: true
description: Array to export
description: Array to export.
isArray: true
- name: headers
description: Array to hold the file headers in order. Also excepts a comma separated list.
isArray: true
- auto: PREDEFINED
defaultValue: UTF-8
description: 'UTF-16-BOM to encode Non English characters. Default is: UTF-8.'
name: codec
predefined:
- UTF-8
- UTF-16-BOM
scripttarget: 0
fromversion: 5.0.0
contentitemexportablefields:
contentitemfields:
fromServerVersion: ''
engineinfo: {}
runas: DBotWeakRole
runonce: false
tests:
- No tests (auto formatted)
14 changes: 9 additions & 5 deletions Packs/CommonScripts/Scripts/ExportToCSV/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
Exports a given array to a CSV file.
Export given array to csv file

## Script Data

---

| **Name** | **Description** |
| --- | --- |
| Script Type | javascript |
| Tags | Utility, csv |


## Inputs

---

| **Argument Name** | **Description** |
| --- | --- |
| fileName | The output filename. |
| csvArray | The array to export. |
| headers | The array to hold the file headers in order. This also will accept a comma-separated list. |
| fileName | output filename |
| csvArray | Array to export |
| headers | Array to hold the file headers in order. Also excepts a comma separated list. |
| codec | UTF-16-BOM to encode Non English characters. Default is: UTF-8 |

## Outputs

---
There are no outputs for this script.
Binary file added pack.zip
Binary file not shown.
Loading