Does anyone have a simple example program that opens up an existing XLS file, writes a couple of rows starting at a specific place in the XLS file, then closes it...saving the changes?
Unconfigured Ad Widget
Collapse
Announcement
Collapse
No announcement yet.
Writing new rows to existing XLS file
Collapse
X
-
If you are using the AIR code, here is a sample:
inFileName = '/Public/'
+ 'Air09_03_Template.xlt';
outFileName = '/Public/'
+ 'Air09_03.xls';
airWorkbook = AirExcel_open(%TRIM(inFileName));
airSheet = AirExcel_getSheet(airWorkbook: 'Data');
// Decrease by 20
airRow = AirExcel_getRow(airSheet:3);
airCell = AirExcel_getCell(airRow:1);
HSSFCell_setCellValueNumeric(airCell: 1.29);
// Increase by 20
airRow = AirExcel_getRow(airSheet:4);
airCell = AirExcel_getCell(airRow:1);
HSSFCell_setCellValueNumeric(airCell: 39.48);
//*** Close the Spreadsheet and Reclaim Resources
AirExcel_write(airWorkbook: %TRIM(outFileName));
Here is what the code does:
- Open the Workbook
- Get the Sheet
- Get the Row
- Get the Cell(s)
- Update the Value(s)
- Save the Workbook
I hope this helps.
Tom
- Open the Workbook
Comment