excel
excel
excel object is used to read or save the value of excel files. Users can save values or other information generated during operation as an excel file by using the excel object. Otherwise, it is used to read the value on the excel.
Methods
Return Type |
Method |
Description |
Close the operating excel file. |
||
Copy the sheet of excel files. |
||
Delete the sheet of excel files. |
||
str |
When opening or saving an excel file is failed, it is able to check an error message. |
|
str |
When entering a sheet, column, and row of excel files, it obtains the value as Sting. |
|
int or float |
When entering a sheet, column, and row of excel files, it obtains the value as Numeric. |
|
boolean |
Open the excel file for that path. |
|
boolean |
Save the excel file on that path. |
|
Set the entered String on the location of the sheet, column, row of excel files. |
||
Set the entered Numbers on the location of the sheet, column, row of excel files. |
Open the excel file for that path. ㆍ Users enter the file path to path as String. - If the excel file is in the project. : Enter the name of excel files including the extension. Example) When opening 'test.xls' in the project : Enter 'test.xls'. - If the excel file is not in the project : Enter the entire path of excel files. Example) When opening 'test.xls' in 'C:\\' : Enter 'C:\\test.xls'. ㆍ If opening a file succeeds, return TRUE, if it fails, return FALSE. - If opening a file succeeds : True(1) - If opening a file fails : False(0) Example)
excel.open('c:\\test.xls') # Open 'test.xls' in 'c:\\'. |
path에 Save the operating excel file on that path. ㆍ Users enter the file path to path as String. - If the excel file is in the project : Enter the name of excel files including the extension. Example)When opening 'test.xls' in the project : Enter 'test.xls'. - If the excel file is not in the project : Enter the entire path of excel files. Example) When opening 'test.xls' in 'C:\\' : Enter 'C:\\test.xls'. ㆍ If saving a file succeeds, return TRUE, if it fails, return FALSE. - If saving a file succeeds : True(1) - If saving a file fails : False(0) ※ Precautions ㆍ You must enter the extension of the open method and save method identically. ㆍ When the same path is entered on the save method and open method, the data of the original file could be disappeared because the excel file had been overwritten. Example)
# Enter the file extension of the open method and save method identically. # If the extension is '.xls'. excel.open('c:\\test.xls') excel.save('d:\\test_save.xls')
# If the extension is '.xlsx'. excel.open('c:\\test.xlsx') excel.save('d:\\test_save.xlsx')
|
close method closes the operating excel file. ㆍ close method has no return values. Example)
excel.close() # Close the operating excel file.
|
When opening or saving an excel file failed, it is able to check an error message. Example) When opening an excel file failed.
open = excel.open('C:\\test.xlsx') # Open 'test.xlsx' in 'c:\\'. # When opening an excel file failed. it is able to find the cause of failure through error messages. if( open == 0 ): openError = excel.errorMessage(); app.messageBox('File open failed', openError); # Print an error message on the message box.
|
= Example) When saving an excel file failed.
save = excel.save('C:\\test_save.xlsx') # Save 'test_save.xlsx' to 'c:\\'. # When saving an excel file failed, it is able to find the cause of failure through error messages. if( save == 0 ): saveError = excel.errorMessage(); app.messageBox('File save failed', saveError); # Print an error message on the message box.
|
deleteSheet is used to delete an excel sheet. ㆍ Enter the name of sheets to sheet. ※ Precautions ㆍ When the same path is entered on save method and open method, the data of the original file could disappear because the excel file has overwritten. Example)
excel.open('C:\\test.xlsx') # Open 'test.xlsx' in 'c:\\'. excel.deleteSheet('delete') # Delete 'delete' sheet. excel.save('C:\\test.xlsx')
|