Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AppendFromXlsx code and text format in Excel
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
AppendFromXlsx code and text format in Excel
Miscellaneous
Thread ID:
01672618
Message ID:
01672618
Views:
112
Hi everybody,

Just ran into an interesting problem with my colleague. I recently updated the way I read information from Excel into a table to use this class
* Version 3.1
FUNCTION AppendFromXlsx
lparameters tcExcelFileName, tcCursorName, tcFFields, tnStartRow, tcSheetName, tlEmptyCells, tcExcludeColumn
* Parameters
* tcExcelFileName	name of the xlsx
					* nom de xlsx
					* numele xlsx-ului
* tcCursorName		name of the table / cursor ; optional ; default ALIAS()
* tcFFields			list of fields to be outputed ; optional ; default all fields
* tnStartRow		starting row (the first tnStartRow - 1 rows are skipped) ; optional ; default 1 (all rows)
					* a partir rangée (les premiers lnStartRows - 1 lignes sont passées) ; optionnel ; défaut 1 (tous les champs lignes)
					* primul rand (primele lnStartRows - 1 randuri ale tabelului din docx sunt omise); optional; implicit 1 (toate randurile)
* tcSheetName		sheet name | number	; optional ; default ''
					* nom | nomber de la feuille ; optionnel ; défaut ''
					* numele |numarul foii	; optional ; implicit ''
* tlEmptyCells		when .T., the source contains empty cells (slower import); optional ; default .F.
					* lorsque .T., la source contient des cellules vides (d'importation plus lent); optionnel ; défaut .F.
					* cand este .T., documentul sursa contine celule goale (importul este mai lent); optional; implicit .F
* tcExcludeColumn   * optional column name to exclude                   .

#DEFINE ERRLANG "En"
#IF ERRLANG = "Ro"
	#DEFINE ERRMESS0 "Eroare"
	#DEFINE ERRMESS1 "Nimic de importat"
	#DEFINE ERRMESS2 "Deschideti, va rog, tabelul / cursorul"
	#DEFINE ERRMESS3 "Foaie inexistenta"
	#DEFINE ERRMESS4 "Eroare la deschiderea"
#ELIF ERRLANG = "Fr"
I forgot who is the owner of the code, Boris, do you recognize it? Can you point me out to the link with it?

What we found is that the spreadsheet had numerical columns (quantity and unit_cost) and the resulting table got completely wrong info. Turned out that when we changed the column to use numeric format (originally it was text), the results came up correctly.

Is anyone familiar with this class? Is there anyway to prevent this possible issue in a future (in case the client gives the spreadsheet using wrong format for these columns and we forget to change)?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform