Good morning.
I am currently using fluidshell to export query results. I am running the follwing code when the SQL code is complete.
\sqlexport -f excel2007 -d My_Database -o C:/Users/MyName/Desktop/Results/Multi_Summary.xlsx
This works however I have 2 questions. Is there a way to name the workbooks? Right now it is naming the workbook “1”. Also, if I am running 2 things of sql code in fluid shell, is there a way to export both results into the same workbook?
Thanks
Gregg
Response
Niels Gron over 6 years ago
FluidShell sqlexport command doesn’t have options to set the workbook name or have multiple worksheets. For this, you would need to us an AquaScript using the AQExcelSpreadsheet API. Here is an example :
http://www.aquafold.com/ads/18.0/openapi/com/aquafold/openapi/data/AQExcelSpreadsheet.html
var ExlSp = aqua.data.excelSpreadsheet(‘C://setcell.xls’);
// example on how to set individual cells
ExlSp.currentWorksheet = ‘Company’;
ExlSp.setCell(5, 3, ‘Created by:’);
ExlSp.setCell(5, 4, aqua.system.getProperty(‘user.name’));
ExlSp.setCell(6, 3, ‘Date:’);
ExlSp.setCell(6, 4, new java.util.Date());
ExlSp.autoResize = true;
// save the excel spreadsheet
ExlSp.save();
2. Simple AquaScript to set columns in a worksheet
var ExlSp = aqua.data.excelSpreadsheet(‘C://setColumn.xls’);
// example on how to set individual cells
ExlSp.currentWorksheet = ‘Company’;
ExlSp.setCell(0, 0, ‘Created by:’);
ExlSp.setCell(0, 1, aqua.system.getProperty(‘user.name’));
ExlSp.setCell(1, 0, ‘Date:’);
ExlSp.setCell(1, 1, new java.util.Date());
// insert dataset to append
var ds = aqua.data.newDataSet([‘Company’,’City’]);
ds.addRowWithValues(“IBM”, “Washington, D.C.”);
ds.addRowWithValues(“Oracle”, “Tokyo”);
ExlSp.row = 3;
ExlSp.column = 5;
ExlSp.insert(ds, true);
ExlSp.autoResize = true;
// save the excel spreadsheet
ExlSp.save();
Up
0
Down
Reply
Gregg Blachstein over 6 years ago
Great. Thanks for the quick response. I’ll take a look at this.