private void WriteToCell(Excel.Worksheet ws)
        {
            Excel.Worksheet activeWorksheet = ws;

            var servicePath = "http://plot.ly/clientresp";
            var username = "******";
            var apiKey = "4n5n0qb2hi";
            ClientResponsePOSTRequest reqArgs = new ClientResponsePOSTRequest()
            {
                un = activeWorksheet.get_Range("L1").Value2,
                key = activeWorksheet.get_Range("L2").Value2,
                origin = activeWorksheet.get_Range("L3").Value2,
                platform = activeWorksheet.get_Range("L4").Value2,
                kwargs = new Kwargs()
                {
                    filename = activeWorksheet.get_Range("L5").Value2,
                    fileopt = activeWorksheet.get_Range("L6").Value2
                },
                args = "[[0, 1, 2], [3, 4, 5], [1, 2, 3], [6, 6, 5]]"

            };
            string result = new PlotlyService().Application_GetServiceResponse(activeWorksheet.get_Range("K1").Value2, reqArgs);
            Excel.Range firstRow = activeWorksheet.get_Range("A1");
            firstRow.Value2 = result;

        }
        private void ButtonSubmit_Click(object sender, EventArgs e)
        {
            ClientResponsePOSTRequest reqArgs = new ClientResponsePOSTRequest()
            {
                un = textBoxUsername.Text,
                key = textBoxAPIKey.Text,
                origin = textBoxOrigin.Text,
                platform = textBoxPlatform.Text,
                kwargs = new Kwargs()
                {
                    filename = textBoxFilename.Text,
                    fileopt = textBoxFileOption.Text
                },
                args = "[[0, 1, 2], [3, 4, 5], [1, 2, 3], [6, 6, 5]]"
            };

            string x = textBoxXColumn.Text;
            string y = textBoxYColumn.Text;

            Excel.Range xCols = ws.get_Range(x + "1").EntireColumn;
            Excel.Range yCols = ws.get_Range(y + "1").EntireColumn;
            List<string> xList = new List<string>();
            List<string> yList = new List<string>();

            if (xCols != null && yCols != null && xCols.Count > 0 && yCols.Count > 0)
            {
                foreach (Excel.Range c in xCols.Cells)
                {
                    if (c.Value2 == null || string.IsNullOrEmpty(c.Value2.ToString()))
                        break;
                    xList.Add(c.Value2.ToString());
                }
                foreach (Excel.Range c in yCols.Cells)
                {
                    if (c.Value2 == null || string.IsNullOrEmpty(c.Value2.ToString()))
                        break;
                    yList.Add(c.Value2.ToString());
                }

                List<string> coords = new List<string>();
                for (int i = 0; i < (xList.Count > yList.Count ? yList.Count : xList.Count); i++)
                {
                    coords.Add(string.Format("[{0},{1}]", xList[i], yList[i]));
                }
                reqArgs.args = string.Format("[{0}]", string.Join(",", coords));
                string result = new PlotlyService().Application_GetServiceResponse(textBoxServiceURL.Text, reqArgs);
                textBox10.Text = result;
            }
        }