Column and Row in excel

 

I search google and mql forum but i cannot find what code for column in excel.

I able to do for rows but column unable to solve....Here code

//+------------------------------------------------------------------+
//|                                               Demo_FileWrite.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//--- show the window of input parameters when launching the script
#property script_show_inputs
//--- parameters for receiving data from the terminal
//input string             InpSymbolName="EURUSD";      // Сurrency pair
//--- parameters for writing data to file
input string             InpFileName="test1.csv";      // File name
input string             InpDirectoryName="Data";     // Folder name

string col1 = "col1";
string col2 = "col2";
string row1 = "row1";
string row2 = "row2";

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- reset last error code
   ResetLastError();
   int file_handle=FileOpen(InpDirectoryName+"//"+InpFileName,FILE_READ|FILE_WRITE|FILE_CSV);
   if(file_handle!=INVALID_HANDLE)
     {
      PrintFormat("%s file is available for writing",InpFileName);
      PrintFormat("File path: %s\\Files\\",TerminalInfoString(TERMINAL_DATA_PATH));
      
      FileWrite(file_handle,col1,col2);
      FileWrite(file_handle,row1,row2);      

      //--- close the file
      FileClose(file_handle);
      PrintFormat("Data is written, %s file is closed",InpFileName);
     }
   else
      PrintFormat("Failed to open %s file, Error code = %d",InpFileName,GetLastError());
  }
  
  

Column = A1 then next Column = A2

 
Jackson0000:

I search google and mql forum but i cannot find what code for column in excel.

I able to do for rows but column unable to solve....Here code

Column = A1 then next Column = A2

Welcome .

Your data cells are missing ,you are essentially writing :

Column1 Column2
Row1 Row2

instead of


Column1 Column2
Row1  data1,1 data1,2
Row2 data2,1 data2,2

consult this code : look at the part @Mark Flint saves the csv 

https://www.mql5.com/en/code/viewcode/13885/127083/historydumpcsv.mq4

 
Lorentzos Roussos:

Welcome .

Your data cells are missing ,you are essentially writing :

Column1 Column2
Row1 Row2

instead of


Column1 Column2
Row1  data1,1 data1,2
Row2 data2,1 data2,2

consult this code : look at the part @Mark F lint saves the csv 

https://www.mql5.com/en/code/viewcode/13885/127083/historydumpcsv.mq4

Thank for reply,

I test this historydumpcsv.... got working with excel google... i realise opensource office sheet is not working. only MS office and google excel


Thank you very much

Reason: