Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetRows() does not work on 1.8.1 #43

Closed
pztrn opened this issue Apr 20, 2017 · 5 comments
Closed

GetRows() does not work on 1.8.1 #43

pztrn opened this issue Apr 20, 2017 · 5 comments

Comments

@pztrn
Copy link

pztrn commented Apr 20, 2017

% go version
go version go1.8.1 linux/amd64

Code:

package main

import (
        "fmt"
        "log"
        "github.com/Luxurioust/excelize"
)

func main() {
        xlsx, err1 := excelize.OpenFile("/tmp/1.xlsx")
        if err1 != nil {
                log.Fatal("Failed to open XLSX file: " + err1.Error())
        }

        // We will always use first sheet.
        sheet_name := xlsx.GetSheetName(1)
        log.Println("Will use sheet: '" + sheet_name + "'")

        // Read file data.
        //file_data := make(map[string]string)
        rows := xlsx.GetRows(sheet_name)
        for _, row := range rows {
                fmt.Println(row)
        }
}
@pztrn
Copy link
Author

pztrn commented Apr 20, 2017

Same on go 1.8.

Tested with files created in MS Office 2013 and Libreoffice 5.3.2.

@xuri
Copy link
Member

xuri commented Apr 20, 2017

@pztrn Thanks for your issue. Function GetRows() doesn't support get rows by sheet name currently, it need to name "Sheet" + index. Relate issue #25.

@pztrn
Copy link
Author

pztrn commented Apr 20, 2017

Why documentation says opposing?

https://godoc.org/github.com/Luxurioust/excelize#File.GetRows

@xuri
Copy link
Member

xuri commented Apr 20, 2017

Sorry. I'll fix the ambiguity of the doc.

@pztrn
Copy link
Author

pztrn commented Apr 20, 2017

I think for now it should be something like:

For now you should use sheet_name like "sheet3" where "sheet" is a constant part and "3" is a sheet number. For example, if sheet named as "SomeUniqueData" and it is second if spreadsheet program interface - you should use "sheet2" here.

xuri added a commit that referenced this issue Apr 22, 2017
- Doc for function `GetRows()` updated, relate issue #43;
- Fix doc typo in `xmlContentTypes.go`;
- Default template updated;
- Readme updated;
- go test updated
xuri added a commit that referenced this issue Apr 25, 2017
- Function `GetRows()` doc updated, relate issue #43;
- go test and embed template updated
@xuri xuri closed this as completed Apr 25, 2017
@xuri xuri mentioned this issue May 10, 2017
xuri added a commit that referenced this issue Sep 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants