After getting the transposed array, you should now be able to write it by bulk into the spreadsheet.
Note:
- I only included the important parts of the code that shows how it's done. Feel free to combine this code into your existing one.
After getting the transposed array, you should now be able to write it by bulk into the spreadsheet.