1. Data integration
  2. Anaplan API Guide and Reference
  3. Use the transactional APIs
  4. Transform Grid CSV to Tabular Single Column format
  5. Pseudocode to transform Grid to TSC format

To assist you with coding your own transformation solutions, we have the following pseudocode to explain the process.

Function ExtractPageItems ( string array GridCSV ):

if view has pages:
   Split the first line of GridCSV by the comma sign into an array of strings,
   Return the resulting array of strings
else:
   Return an empty array

End Function

Function MapColumnItems (string array GridCSV ):
dictionary ColumnItems will map column index to column dimension items.

For every row in GridCSV which represents dimension items on columns:
   Split the row by the comma sign into an array of strings.
   For every string in the resulting array:
       Add the index of the string and the value of the string as a key-value pair to ColumnItems
   End inner loop
End outer loop

Return ColumnItems

End Function

Function MapRowItems ( string array GridCSV ):
dictionary RowItems will map row index to row dimension items.

For every row in GridCSV following the rows representing dimension items on columns:
   Split the row by the comma sign into an array of strings.
   For every dimension on rows:
       Take the next index and string value of the resulting array and add them as a key-value pair to RowItems
   End inner loop
End outer loop

Return RowItems

End Function

Function BuildTabularSingleColumnOutput ( dictionary ViewMetadata,
string array PageItems,
dictionary ColumnItems,
dictionary RowItems,
string array GridCSV )
Print all "pages" dimensions from ViewMetadata separated by and followed by a comma.
Print all "columns" dimensions from ViewMetadata separated by and followed by a comma.
Print all "rows" dimensions from ViewMetadata separated by and followed by a comma.
Print "Value".
Print new line.

For every entry in the RowItems dictionary:
   For every entry in the ColumnItems dictionary:
   
       Print all PageItems separated by and followed by a comma.
       Print all dimension items in the current ColumnItems entry separated by and followed by a commma.
       Print all dimension items in the current RowItems entry separated by and followed by a commma.
       Splitting every row of GridCSV by the comma sign results in a strings matrix (array of array of strings).
       The submatrix within GridCSV that is the result of ignoring the pages row, column headers rows and row headers columns
       contains all the cell values of the view.
       Print the cell value from that submatrix using the indices in the current entries' keys.
       Print new line.
       
   End inner loop
End outer loop

End Function

dictionary of axes to dimensions ViewMetadata // can easily be extracted from the View Metadata API
array of strings PageItems = ExtractPageItems ( GridCSV )
dictionary of indices to dimension items ColumnItems = MapColumnItems ( GridCSV )
dictionary of indices to dimension items RowItems = MapRowItems ( GridCSV )
BuildTabularSingleColumnOutput ( ViewMetadata, PageItems, ColumnItems, RowItems, GridCSV )