*/
struct spreadsheet_read_options
{
- const char *sheet_name ; /* The name of the sheet to open (in UTF-8) */
+ char *sheet_name ; /* The name of the sheet to open (in UTF-8) */
int sheet_index ; /* The index of the sheet to open (only used if sheet_name is NULL) */
- const char *cell_range ; /* The cell range (in UTF-8) */
+ char *cell_range ; /* The cell range (in UTF-8) */
bool read_names ; /* True if the first row is to be used as the names of the variables */
int asw ; /* The width of string variables in the created dictionary */
};
int
cmd_get_data (struct lexer *lexer, struct dataset *ds)
{
+ struct spreadsheet_read_options opts;
char *tok = NULL;
lex_force_match (lexer, T_SLASH);
char *filename = NULL;
struct casereader *reader = NULL;
struct dictionary *dict = NULL;
- struct spreadsheet_read_options opts;
+
if (!parse_spreadsheet (lexer, &filename, &opts))
goto error;
dataset_set_dict (ds, dict);
dataset_set_source (ds, reader);
free (tok);
- destroy_spreadsheet_read_info (&opts);
return CMD_SUCCESS;
}
- destroy_spreadsheet_read_info (&opts);
}
else
msg (SE, _("Unsupported TYPE %s."), tok);
error:
+ destroy_spreadsheet_read_info (&opts);
free (tok);
return CMD_FAILURE;
}
destroy_spreadsheet_read_info (struct spreadsheet_read_options *opts)
{
free (opts->cell_range);
+ free (opts->sheet_name);
}