Innov-AI
    Documentation | MentDB Weak Server
SQL Database to Excel(X)

  • Excel:
  • try {
    
    	sql connect "session1" {cm get "demo_cm_mysql";};
    
    	excel load empty "excelId";
    	excel sheet add "excelId" "sheet1";
    
    	-> "[i_row]" 0;
    	sql parse "session1" "T" (concat "select id, name, quantity from products") {
    	
    		excel cell set "excelId" "sheet1" [i_row] 1 [T_id] NUM;
    		excel cell set "excelId" "sheet1" [i_row] 2 [T_name] STR;
    		excel cell set "excelId" "sheet1" [i_row] 3 [T_quantity] NUM;
    
    		++ "[i_row]";
    	
    	};
    
    	excel save "excelId" "/Users/jimmitry/Desktop/file.xls";
    
    	excel close "excelId";
    	sql disconnect "session1";
    
    } {
    
    	try {excel close "excelId";} {} "[err]";
    	try {sql disconnect "session1";} {} "[err]";
    
    } "[err]";
  • ExcelX:
  • try {
    
    	sql connect "session1" {cm get "demo_cm_mysql";};
    
    	excelx load empty "excelId";
    	excelx sheet add "excelId" "sheet1";
    
    	-> "[i_row]" 0;
    	sql parse "session1" "T" (concat "select id, name, quantity from products") {
    	
    		excelx cell set "excelId" "sheet1" [i_row] 1 [T_id] NUM;
    		excelx cell set "excelId" "sheet1" [i_row] 2 [T_name] STR;
    		excelx cell set "excelId" "sheet1" [i_row] 3 [T_quantity] NUM;
    
    		++ "[i_row]";
    	
    	};
    
    	excelx save "excelId" "/Users/jimmitry/Desktop/file.xls";
    
    	excelx close "excelId";
    	sql disconnect "session1";
    
    } {
    
    	try {excelx close "excelId";} {} "[err]";
    	try {sql disconnect "session1";} {} "[err]";
    
    } "[err]";
Services     Supporters     Contact     About     Legal notice © 2024