golang xlsx读写

作者: Feng_Sir | 来源:发表于2018-06-21 14:59 被阅读0次
    func TestRequest_LoadFromRemote2(t *testing.T) {
    
        xlsxfile2, err := xlsx.OpenFile("E:/apihub/1数据核查/信息核查数据.xlsx")
        if err != nil{
            fmt.Println( err)
            return
        }
        for _, sheet := range xlsxfile2.Sheets {
            for indexr, row := range sheet.Rows {
                if indexr < 2 {
                    continue
                }
                //if indexr >= 3{
                //  break
                //}
                fmt.Print(fmt.Sprint(indexr)+"姓名:",strings.Trim(row.Cells[1].Value," ")," 身份证号:",strings.Trim(row.Cells[2].Value," "))
                request := Request{}
                request.IdCode = strings.Trim(row.Cells[2].Value," ")
                request.Name = strings.Trim(row.Cells[1].Value," ")
                ret, cost, e, remark := request.LoadFromRemote()
                fmt.Println(ret, cost, e, remark)
                row.AddCell().Value = fmt.Sprint(ret)
                fmt.Println()
    
    
            }
        }
        err = xlsxfile2.Save("E:/apihub/1数据核查/信息核查数据结果.xlsx")
        if err != nil{
            log.Println(err)
            return
        }
    
        fmt.Println("ok")
    
    }
    

    相关文章

      网友评论

        本文标题:golang xlsx读写

        本文链接:https://www.haomeiwen.com/subject/lyoqyftx.html