-
Notifications
You must be signed in to change notification settings - Fork 302
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
Function only reading filtered rows. How do I read all rows from a sheet? #246
Comments
I am using XLSX2CSV because it is faster in reading excel files as compared to read_excel() from openpyxl. But using XLSX2CSV only reads filtered rows of a sheet whereas read_excel reads all rows regardless if the sheet is filtered or not. |
Hello, I have just experimented it also. Is there a way/option that XLSX2CSV would read all rows of a sheet ? |
what is a filtered row? can you share a sample xlsx file? |
In the attached file, ColumnA is filtering rows only showing 'A' value in ColumnA (not showing the rows beginning with 'B' value) |
Here is another example. The openpyxl function returns all rows regardless
if the sheet is pre filtered or not but the XLSX2CSV only returns the pre
filtered rows.
Abhishek
…On Wed, 21 Dec 2022 at 12:08, TongsasTong ***@***.***> wrote:
In the attached file, ColumnA is filtering rows only showing 'A' value in
ColumnA (not showing the rows beginning with 'B' value)
The xlsx2csv would only convert the visible rows, not all rows as Excel
would do.
Samplefile.xlsx
<https://github.com/dilshod/xlsx2csv/files/10280128/Samplefile.xlsx>
—
Reply to this email directly, view it on GitHub
<#246 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4YGWD75OHFZGECCBFZEN7TWONBR7ANCNFSM6AAAAAAS7F2HWU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Here is sample file Car.xlsx |
Looks like dilshod has fixed the issue. I downloaded the xlsx2csvc.py file in the repository and replaced the old file in my local machine with this new one. I added the skip_hidden_rows as False in my function mentioned above and now it works. However, I need to know when this version will be available via pip install command so that all the users can get the updated version instead of manually downloading this file. Can someone please help with that? def read_excel_file(path: str, sheet_index: int) -> pd.DataFrame: |
Thank you again @dilshod !! |
@dilshod When will the latest version be released so that I can do pip install? |
@dilshod is there an update on this? |
It is available via pip now, this issue can be closed! |
I think |
Yes, also, this is the default beahvior of excel when saviong to csv file |
Here is my code -
filepath = os.path.join(FolderPath, FileName)
a = load_workbook(filepath, read_only=True)
def read_excel_file(path: str, sheet_index: int) -> pd.DataFrame:
buffer = StringIO()
Xlsx2csv(path, outputencoding="utf8").convert(buffer,sheetid=sheet_index)
buffer.seek(0)
df = pd.read_csv(buffer)
return df
dfinal=read_excel_file(filepath,a.index(a.get_sheet_by_name('Sheetname'))+1)
The text was updated successfully, but these errors were encountered: