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

Question: How to get all cells & rows? #16

Closed
jordyvandomselaar opened this issue Jan 18, 2017 · 4 comments
Closed

Question: How to get all cells & rows? #16

jordyvandomselaar opened this issue Jan 18, 2017 · 4 comments

Comments

@jordyvandomselaar
Copy link

As the title says, how to get all rows and their cells? I don't know beforehand how many rows or cells there'll be.

@xuri
Copy link
Member

xuri commented Jan 18, 2017

@jordyvandomselaar Thanks for your issue. You can use GetRows to get all the rows in a sheet like this:

rows, err := f.GetRows("Sheet1")
if err != nil {
    fmt.Println(err)
    return
}
for _, row := range rows {
    for _, colCell := range row {
        fmt.Print(colCell, "\t")
    }
    fmt.Println()
}

The full API docs can be seen on go.dev. If you have any questions or concerns, please let me know by replying to this issue.

@xuri xuri closed this as completed Jan 18, 2017
@jordyvandomselaar
Copy link
Author

Hmm, kept returning an empty slice.

@xuri xuri reopened this Jan 19, 2017
@xuri xuri closed this as completed Jan 19, 2017
@xuri
Copy link
Member

xuri commented Jan 19, 2017

@jordyvandomselaar Verify that the given sheet index is valid or attach your code and .xlsx file if possible.

@jordyvandomselaar
Copy link
Author

I ended up using another lib, but I ran the functions to get the active sheet name which I used in getRows()

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