Skip to content

Commit

Permalink
[Marketplace Contribution] Common Scripts - Content Pack Update (demi…
Browse files Browse the repository at this point in the history
…sto#35407)

* [Marketplace Contribution] Common Scripts - Content Pack Update (demisto#35297)

* "contribution update to pack 'Common Scripts'"

* resolved rebase conflicts

---------

Co-authored-by: israelpoli <[email protected]>

* add TPB

* resolve conflicts

* add TPB to conf.json and yml file

* Bump pack from version CommonScripts to 1.15.30.

* commit

* remove new tpb from conf json

---------

Co-authored-by: xsoar-bot <[email protected]>
Co-authored-by: israelpoli <[email protected]>
Co-authored-by: ipolishuk <[email protected]>
Co-authored-by: Content Bot <[email protected]>
  • Loading branch information
5 people committed Sep 10, 2024
1 parent fcc8a41 commit ccac672
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
6 changes: 6 additions & 0 deletions Packs/CommonScripts/ReleaseNotes/1_15_30.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Scripts

##### ExportToCSV

- 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
15 changes: 12 additions & 3 deletions Packs/CommonScripts/Scripts/ExportToCSV/ExportToCSV.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,28 @@ 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
tests:
- exporttocsv_script_test
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.
2 changes: 1 addition & 1 deletion Packs/CommonScripts/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Common Scripts",
"description": "Frequently used scripts pack.",
"support": "xsoar",
"currentVersion": "1.15.29",
"currentVersion": "1.15.30",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down

0 comments on commit ccac672

Please sign in to comment.