Hi All,
I'm using for the first time the Export Data Store Entity to Excel Smart Service to add data to an existing excel template (saved as a doc in appian) (Exporting data to a formatted Excel sheet).
Once I add the data to the excel it seems it adds it in the same row and erases anything on the same row that was there before, I'm trying to add the new data only in one column, different rows instead in one whole row.
Does someone know if this is possible or how I should be configuring the parameters.
customCellPositions
List of Text String
(Optional) Array of cell positions where custom cell values should be added.
customCellValues
(Optional) Array of values to be added on the specified custom cell position.
Or if you could recommend a different smart service to achieve this?
Thanks in advance
Discussion posts and replies are publicly visible
Hi,
You can use the parameters by passing customCellPositions (e.g., A1,A2,A3,...) and customCellValues (e.g., 1,2,3,...). This will place the data in the specified cell positions within the Excel file.
However, I'm not entirely sure whether this approach will override any existing content in those cells. It should insert the data as defined, but please test it to confirm the behavior in your specific case.
customCellPositions: {"B2", "B3", "B4"} customCellValues: {"Apple", "Banana", "Orange"}
Yes, I tried this before it would throw an error this:
The starting cell I'm using is "A1"
customCellPositions: {"A1", "A2"}
Custom cell positions cant refer to cells below the starting cell. Otherwise, they would be overwritten by data being exported. (APNX-1-4505-037)
Also, I noticed that for customcellvalues it doesnt let me use it on its own, this is plus the data in the store entity. So it adds both data from the data store entity which is a required parameter and these custom cells.
I want to make sure the one coming from the data store entity is the one I can actually manipulate to put in the specific cells I need.
My suggestion is to use a different smart service, one that accepts a Base Template, because even after years of complaining, they have not seen fit to update the Export DSE to Excel smart service with this most basic of functionalities.
I used to recommend installing the Excel Tools plug-in and using one of the (deprecated-but-still-working-perfectly-fine) original smart services, usually Export CDT to Excel. However there is now a more recent plug-in, "JSON to Excel", which also takes a base template, and (unlike "Export CDT...") doesn't even require you to use a specific CDT to handle your export (meaning you're free to do data transforms as you wish prior to feeding the JSON array to the smart service).
Thank you for this suggestion Mike - I currently have the excel tools plug in installed, if I decided to go this route could you recommend what I should be using instead?Installing a plug in requires a lot of higher approvals and it might take some time until I get installed for the "JSON to Excel" you mentioned.
Thanks again
Then definitely try out the "CDT to Excel" node - it's marked as "deprecated" but as i mentioned, has continued to work anyway. It works perfectly with pre-formatted templates.
In this case if for example, I need to place the process variable values in some specific cells in the excel template. How would I do that?
Lets say I have one cdt, with 3 fields
cell A2: value of cdt.field1
cell B6: value of cdt.field2
cell C20: value of cdt.field3
CDT to Excel is designed specifically to accept an array of CDT and output it to a series of rows of Excel data in a contiguous manner. That's the main usage anyway. But it does (also) let you populate some individual cells with arbitrary values, by passing in an array of cell positions and their values (the values can be anything expressionable, the CDT you use to populate the main part is irrelevant to this).
If you're *only* trying to write 3 arbitrary cell values to an excel sheet, then I must admit I'm a little confused why you're even bothering with an Excel doc. The use case for the "manual cell value" thing is usually to populate some hardcoded supporting data that gives some additional info about the report shown on the rest of the sheet.
The example I gave is 3 fields but the actual implementation is over 30 fields that need to be placed specifically in the template which is an excel file, and they are not one row after the other thats why I was trying to see what would be the best option.
As far as I know it can handle any number of arbitrary field placements - the cell names and values are each just expressionable inputs and don't have a size limit per se, as long as they both match in length.
The only thing I noticed is that if I dont provide a cdt it throws an error message, The following error was raised by the Export to Excel function: Cannot read the array length because "<local18>" is null.I dont want to add the CDT and output it to a series of rows of Excel data in a contiguous manner, like you mentioned I only want to be able to use the cell values and cell keys option. Even though it says that cdt is optional it gives me that error.