Hi,
Part of my application involved uploading datasheets via a web portal. The sheets can be in any spreadsheet format.
My app uses predefined 'plugins' to translate these datasheets into a flat format that is easier to manipulate into our data structure.
Some of these files can be huge (well, many Mb) which takes a few minutes to upload depending on the upload speed. Some files (one in particular) also take a looong time to flatten.
I would love to start processing the file by reading the stream as soon as they start uploading.
This works fine for csv, but xls and xlsx files can't be processed until the file is fully uploaded, opened and converted into a standard object[][] ready for flattening.
So, my question: Is there any way I can process the file on the clients machine via client-side code? I would need to open the file and save one or many sheets as csv then upload them.
Is this possible? Maybe I can create a plugin for chrome? I'd rather not need to install anything.
Sorry if this sounds a bit ridiculous, but I know I'm behind the times on tech so I was hoping that there was some way.
Thanks
Andy ^_^
What I have tried:
I'll show you my upload stream code:
var file = context.Request.Files[i];
byte[] input = new byte[file.ContentLength];
var stream = file.InputStream;
stream.Read(input, 0, file.ContentLength);
if (!importedFiles.ContainsKey(file.FileName))
importedFiles.Add(file.FileName,null);
importedFiles[file.FileName] = new FileImportWizardItem
{
Name = file.FileName,
Size = file.ContentLength,
DateTime = DateTime.Now,
File = input
};
RateTicker.NotifyFileImported(context, file.FileName, file.ContentLength);
ConvertFile(context, supplierId, importedFiles[file.FileName]);