Excel Post Processing Data
-
I have an Excel report template that needs the timestamp in two columns (locale and epoch). Currently I have all data populated in the report, minus the column for epoch.
Is there a way to get the range of cells added to the report in post processing, so I can update the second column in the script?
I've tried ExcelReportUtility.getUsedRanges(), but I'm not sure what type of object the keys map to. It looks like this in the log output. The typeof says object, but I haven't found any object/array/string functions, or keys/methods, that work on it yet.
{Date__EPOCH=Date__EPOCH @ Sheet1!$B$2-->Sheet1!$B$6}
openNamedRange is fine for writing, but it doesn't return anything or have a corresponding function for reading. The majority of the other functions seem to be for reading/writing known cells.
This other post only gives the report's start/end time, not the data in the report itself.
https://forum.infiniteautomation.com/topic/4091/excel-reports-post-processing-script-question/7
If there's any documentation on these objects, available source code, or a way to get them to show up in the developer console instead of as text in the script output that would be helpful. I haven't been able to locate the source code for the Excel reporting.
I have the code I need to do any kind of conversion on the timestamps, I really just can't figure out what to key off of for my loop. I also can't reference the variable name for the timestamps. Only the points have variables. Any help is appreciated.
-
Taking a different approach, this example works for copying the value. So it should get me what I need, but I'd still like to know if there is a way to get the count of rows for a given variable or named range if possible.
In this example my timestamp is the first column, and epoch is the second column. I have headers above the named ranges, so it starts at row 1. This also assumes that the 'Date__EPOCH' range is empty when post processing starts.
ExcelReportUtility.openNamedRange('Date__EPOCH', false); var timestamp = null; var i = 1; do { timestamp = ExcelReportUtility.getString(0, 0, i); if (timestamp == null) { break; } ExcelReportUtility.writeStringToNamedRange('Date__EPOCH', timestamp); i += 1; }while (timestamp != null);