Import Pb in Excel

Source: Internet
Author: User

 

String ls_excelpath, docname
Integer li_rtn
Li_rtn = getfileopenname ("select file", ls_excelpath, docname, "xls", + "text files (*. XLS ),*. xls, "+" doc files (*. XLS ),*. xls ")
Oleobject oxls, osheet, obook
Integer ll_xls
Oxls = create oleobject
Ll_xls = oxls. connecttoobject ('', 'excel. application ')
Long ll_row, currow
Decimal ld_tmp
String ls_value
Currow = 1
// Set the data to be imported from the second row of Excel.
Obook = oxls. workbooks. Open (ls_excelpath)
Osheet = oxls. Sheets (1)
Do While true
Ls_value = string (osheet. cells (currow, 1). value)
// Read the Excel content and put it in the variable, cells (rows, columns)
If f_is_null (ls_value, "") = "" Then exit
// If empty, the import is complete.
Ll_row = dw_1.insertrow (0)
// Add rows to the data window
Dw_1.setitem (currow, "column name", string (ls_value ))
Currow ++
Loop
Obook. Close
Destroy osheet
Destroy obook
Destroy oxls
Return 0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.