question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Excel file without headers, skipping first line

See original GitHub issue

We are trying to use the library on an excel without headers(We set a template for download to show the way its meant to be used, but apparently thats not what they have in mind), but we saw in the code, that no matter what, the first row is always ignored because of the hardcoded + 1, there´s no way we can set skip or headerStart as negative cause an exception is thrown. Is there an option we hadn’t see to read an excel without headers?

        public static PoijiOptionsBuilder settings(int skip) {
            if (skip < 0) {
                throw new PoijiException("Skip index must be greater than or equal to 0");
            }
            return new PoijiOptionsBuilder(skip);
        }
        public PoijiOptionsBuilder headerStart(int headerStart) {
            if (headerStart < 0) {
                throw new PoijiException("Header index must be greater than or equal to 0");
            }
            this.headerStart = headerStart;
            return this;
        }
        public PoijiOptions build() {
            return new PoijiOptions()
                    .setSkip(skip + headerStart + 1)
                    .setPassword(password)
                    .setPreferNullOverDefault(preferNullOverDefault)
                    .setDatePattern(datePattern)
                    .setDateFormatter(dateFormatter)
                    .setDateTimeFormatter(dateTimeFormatter)
                    .setSheetIndex(sheetIndex)
                    .setSheetName(sheetName)
                    .setIgnoreHiddenSheets(ignoreHiddenSheets)
                    .setTrimCellValue(trimCellValue)
                    .setDateRegex(dateRegex)
                    .setDateTimeRegex(dateTimeRegex)
                    .setDateLenient(dateLenient)
                    .setHeaderStart(headerStart)
                    .setCasting(casting)
                    .setLimit(limit)
                    .setPoijiLogCellFormat(cellFormat)
                    .setPoijiNumberFormat(numberFormat)
                    .setCaseInsensitive(caseInsensitive)
                    .setNamedHeaderMandatory(namedHeaderMandatory);
        }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ozlerhakancommented, Jul 19, 2020

fix is ready with 3.0.0

1reaction
fernando1983githubcommented, Jul 17, 2020

Hi @ozlerhakan, wasn’t able to respond. That’s great news, thanks for the immediate response, looking forward to it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Turn Excel table headers on or off - Microsoft Support
When you create an Excel table, a table Header Row is automatically added as the first row of the table, but you have...
Read more >
How to read a excel file without taking its first row as header ...
First answer on google when you search for "pandas read excel file skip header": Pandas doc for method read_excel which has a skiprows ......
Read more >
How to get excel row numbers to skip the header - Super User
This formula keeps the row numbers accurate when sorting, and does not count the first row for the headings. (1) You don't need...
Read more >
Skip first rows excel and read headers - Alteryx Community
That option is only available in xlsx and not xls. You can use the "first row contains data" to push your headers into...
Read more >
[Solved] Streamwriter skipping my first row of data - CodeProject
I my work with connecting to Excel using C#, I've not seen it skip two lines. My guess is that you don't have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found