Skip to content

Commit 87bb9a6

Browse files
authored
Merge pull request #121 from abhishek-butola/master
add parseRaw parameter
2 parents bbbcedb + 532418c commit 87bb9a6

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/ReactSpreadsheetImport.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export const defaultRSIProps: Partial<RsiProps<any>> = {
1717
uploadStepHook: async (value) => value,
1818
selectHeaderStepHook: async (headerValues, data) => ({ headerValues, data }),
1919
matchColumnsStepHook: async (table) => table,
20-
dateFormat: "yyyy-mm-dd", // ISO 8601
20+
dateFormat: "yyyy-mm-dd", // ISO 8601,
21+
parseRaw: false,
2122
} as const
2223

2324
export const ReactSpreadsheetImport = <T extends string>(props: RsiProps<T>) => {

src/steps/UploadStep/components/DropZone.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type DropZoneProps = {
1313
}
1414

1515
export const DropZone = ({ onContinue, isLoading }: DropZoneProps) => {
16-
const { translations, maxFileSize, dateFormat } = useRsi()
16+
const { translations, maxFileSize, dateFormat, parseRaw } = useRsi()
1717
const styles = useStyleConfig("UploadStep") as typeof themeOverrides["components"]["UploadStep"]["baseStyle"]
1818
const toast = useToast()
1919
const [loading, setLoading] = useState(false)
@@ -39,7 +39,7 @@ export const DropZone = ({ onContinue, isLoading }: DropZoneProps) => {
3939
onDrop: async ([file]) => {
4040
setLoading(true)
4141
const arrayBuffer = await readFileAsync(file)
42-
const workbook = XLSX.read(arrayBuffer, { cellDates: true, dateNF: dateFormat })
42+
const workbook = XLSX.read(arrayBuffer, { cellDates: true, dateNF: dateFormat, raw: parseRaw })
4343
setLoading(false)
4444
onContinue(workbook)
4545
},

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export type RsiProps<T extends string> = {
4141
initialStepState?: StepState
4242
// Date format to use e.g. "yyyy-mm-dd hh:mm:ss", "m/d/yy h:mm", 'mmm-yy', etc.
4343
dateFormat?: string
44+
//Skips parsing of values e.g. date
45+
parseRaw?: boolean
4446
}
4547

4648
export type RawData = Array<string | undefined>

0 commit comments

Comments
 (0)