Generate Excel file (xls or xlsx) based on script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 07:58 AM
Hello All,
I am looking for some help to generate an Excel file based on Script. I read a lot of content based on CSV file, but the request is to have a XLS or XLXS file. So, I have the script results working fine for csv, so I just want to "improve" the result.
The request is:
I want an Excel file to show in the header the name of the field (ex: Assignment Group) and the number of records assigned to them (ex: 5). There is more complexity to obtain the result (filtering and using Glideaggregate), but the final output into the file should be like this:
Assignment Group | Quantity |
Group A | 5 |
Group B | 2 |
The current code that I am using you can find below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 02:16 AM
You need to create a new style for it.
<Style ss:ID='BlueCell'>
<Font ss:Size='16'/>
<Interior ss:Color='#a5d8ff' ss:Pattern='Solid'/> // Add blue background
<Alignment ss:Horizontal='Center' ss:Vertical='Center' ss:WrapText='1'/>
</Style>
and use it like this
<Cell ss:StyleID='BlueCell'><Data ss:Type='String'>text...</Data></Cell>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 10:45 PM
Thanks George. It worked.
Also can you help me with what other tags I can use for more formatting. Like we used interior for background color, what tag we can use for to increase size of excel cell as wrap text true is not looking good.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 09:06 PM
Thanks @AJAY1231 this script worked perfectly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2024 05:57 PM
Do you provide how you assemble the data into the excelData variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 07:36 AM - edited 01-15-2025 06:07 AM
Well, if your goal is to group data, like showing Assignment Group and Quantity, you can tweak the script to use GlideAggregate to get those grouped results and then build the rows dynamically based on the output.
If you’re looking to learn more about how Excel works with scripts or want to refine your approach, Microsoft Excel Books has some great resources. It’s a good place to explore ideas and pick up tips for handling Excel files programmatically.