duckdb / duckdb/duckdb-excel

`all_varchar = true` converts boolean values to numbers before returning them as strings

Open
#76 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
62
Forks
24
PR merge metrics
No merged PRs in 30d

Description

### Problem Description

I'm trying to read the data from some excel files as strings. However, excel extension is coercing the boolean values to their numeric representations before returning them as strings. This leads to some interesting quirks when I'm dealing with mixed values in a column. The following reproduction dramatizes the ambiguity caused by this issue.

### How to reproduce

Run the following query on this file: [wb.xlsx](https://github.com/user-attachments/files/24196107/wb.xlsx).

```sql
select * from read_xlsx('./wb.xlsx', header = true, all_varchar = true);
```

### Expected behavior

| Property | Value |
|--------|--------|
| available | TRUE |
| units | 1 |
| returnable | FALSE |
| shipping_charges | 0 |

### Current behavior

| Property | Value |
|--------|--------|
| available | 1 |
| units | 1 |
| returnable | 0 |
| shipping_charges | 0 |

### Version Information

```sh
DuckDB v1.4.2 (Andium) 68d7555f68
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the supplied read_xlsx query against wb.xlsx with all_varchar = true and trace how boolean cells are converted. Done when boolean values are returned as TRUE and FALSE strings while numeric values remain unchanged, and the reproduction behaves as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.