title: $:/plugins/tiddlywiki/xlsx-utils/controls caption: XLSX Utilities tags: $:/tags/ControlPanel \define help-button(state) <$button popup="""$:/state/expand-help/$state$""" class="tc-btn-invisible tc-popup-keep"> {{$:/core/images/help}} \end \define help-content(type,state) <$reveal tag="span" state="""$:/state/expand-help/$state$""" type="popup" position="below">
<$transclude tiddler="""$:/plugins/tiddlywiki/xlsx-utils/docs/$type$""" mode="block"/>
\end \define renameProxyTitle() $:/state/plugins/tiddlywiki/xlsx-utils/rename-$(currentTiddler)$ \end \define rename-current-tiddler() <$edit-text tag="input" tiddler=<> placeholder="Rename" default=<> size="50"/> <$reveal type="nomatch" state="""$(renameProxyTitle)$""" text=<> default=<> tag="span"> <$button> <$action-deletetiddler $tiddler=<>/> cancel <$button> <$action-sendmessage $message="tm-rename-tiddler" from=<> to={{$(renameProxyTitle)$}}/> <$action-deletetiddler $tiddler=<>/> rename <$set name="proxy-title" value={{$(renameProxyTitle)$}}> <$list filter="""[is[tiddler]]"""> Warning: tiddler already exists \end \define expand-collapse-button(state) <$reveal state="""$:/state/expand/$state$""" type="match" text="yes" default="no" tag="span"> <$button class="tc-btn-invisible"> <$action-setfield $tiddler="""$:/state/expand/$state$""" $value="no"/> {{$:/core/images/down-arrow}} <$reveal state="""$:/state/expand/$state$""" type="nomatch" text="yes" default="no" tag="span"> <$button class="tc-btn-invisible"> <$action-setfield $tiddler="""$:/state/expand/$state$""" $value="yes"/> {{$:/core/images/right-arrow}} \end \define expand-collapse-content(state,content,class) <$reveal state="""$:/state/expand/$state$""" type="match" text="yes" default="no" tag="div" class="""$class$""" animate="yes" retain="yes"> $content$ \end \define up-down-buttons(parent,child) <$list filter="[list<$parent$>butfirst[]field:title<$child$>limit[1]]" variable="listItem"> <$button class="tc-btn-invisible"> <$action-listops $tiddler=<<$parent$>> $subfilter="+[move:-1<$child$>]"/> {{$:/core/images/chevron-up}} <$list filter="[list<$parent$>butlast[]field:title<$child$>limit[1]]" variable="listItem"> <$button class="tc-btn-invisible"> <$action-listops $tiddler=<<$parent$>> $subfilter="+[move:1<$child$>]"/> {{$:/core/images/chevron-down}} \end \define edit-button(state) <$reveal state="""$:/state/edit/$state$""" type="nomatch" text="yes" default="no" tag="span"> <$button class="tc-btn-invisible"> <$action-setfield $tiddler="""$:/state/edit/$state$""" $value="yes"/> <$action-setfield $tiddler="""$:/state/expand/$state$""" $value="yes"/> {{$:/core/images/edit-button}} <$reveal state="""$:/state/edit/$state$""" type="match" text="yes" default="no" tag="span"> <$button class="tc-btn-invisible"> <$action-setfield $tiddler="""$:/state/edit/$state$""" $value="no"/> {{$:/core/images/done-button}} Finish editing \end \define delete-item-button(filter,parent,title,prompt) <$button class="tc-btn-invisible"> <$action-deletetiddler $filter="""$filter$"""/> <$action-listops $tiddler="""$parent$""" $subfilter="-[[$title$]]"/> {{$:/core/images/delete-button}}$prompt$ \end \define edit-field() <$select tiddler=<> field="import-field-list-op" default="none"> <$edit-text tiddler=<> field="import-field-name" size="10" tag="input" placeholder="field name"default=""/> <$reveal state="""$(field)$!!import-field-list-op""" type="match" text="none" default="none" tag="span"> to <$reveal state="""$(field)$!!import-field-list-op""" type="match" text="append" default="none" tag="span"> the <$select tiddler=<> field="import-field-type" default="string"> <$select tiddler=<> field="import-field-source" default="column"> <$reveal state="""$(field)$!!import-field-source""" type="match" text="column" default="column" tag="span"> <$edit-text tiddler=<> field="import-field-column" tag="input" placeholder="column" default=""/> prefixed <$edit-text tiddler=<> field="import-field-prefix" tag="input" placeholder="prefix" default=""/>, suffixed <$edit-text tiddler=<> field="import-field-suffix" tag="input" placeholder="suffix" default=""/> <$reveal state="""$(field)$!!import-field-source""" type="match" text="constant" default="column" tag="span"> <$edit-text tiddler=<> field="import-field-value" tag="input" placeholder="constant" default=""/>
Title: <$tiddler tiddler=<>> <> \end \define view-field() <$link to=<>> <$list filter="[!has[import-field-list-op]]" variable="listItem"> Set field ''<$view tiddler=<> field="import-field-name"/>'' to <$list filter="[get[import-field-list-op]prefix[append]]" variable="listItem"> Append to list field ''<$view tiddler=<> field="import-field-name"/>'' <$list filter="[has[import-field-prefix]]" variable="listItem"> ''<$view tiddler=<> field="import-field-prefix"/>'' + <$list filter="[get[import-field-type]prefix[date]]" variable="listItem"> date <$list filter="[get[import-field-source]prefix[column]]" variable="listItem"> value from column ''<$view tiddler=<> field="import-field-column"/>'' <$list filter="[get[import-field-source]prefix[constant]]" variable="listItem"> constant ''<$view tiddler=<> field="import-field-value"/>'' <$list filter="[has[import-field-suffix]]" variable="listItem"> + ''<$view tiddler=<> field="import-field-suffix"/>'' \end \define list-fields()
    <$list filter="[list]" variable="field" emptyMessage="
    (No field import specifiers)
    ">
  • <$reveal state="""$:/state/edit/$(row)$""" type="match" text="yes" default="no" tag="span"> <> <> <$macrocall $name="delete-item-button" filter="[]" parent=<> title=<>/> <$reveal state="""$:/state/edit/$(row)$""" type="nomatch" text="yes" default="no" tag="span"> <>
\end \define view-row-content() <$reveal state="""$:/state/edit/$(row)$""" type="match" text="yes" default="no" tag="ul" class="tc-import-spec-row-controls" animate="yes" retain="yes">
  • <$macrocall $name="delete-item-button" filter="[] [getlist[]]" parent=<> title=<> prompt=" Delete this row"/>
  • Title: <$tiddler tiddler=<>> <>
  • <$button class="tc-btn-invisible"> <$action-createtiddler $basetitle="$:/_ExcelImporter/ImportSpecifiers/Field" $savetitle="$:/temp/newtiddler" import-spec-role="field" import-field-name="fieldname" import-field-type="string" import-field-source="column" import-field-column="Column Name" /> <$action-listops $tiddler=<> $subfilter="[{$:/temp/newtiddler}]"/> {{$:/core/images/new-button}} Add new field
  • <> \end \define view-row()
    <$macrocall $name="expand-collapse-button" state=<>/> Each row: <$list filter="[listimport-field-name[title]]" variable="field" emptyMessage=" <$link to=<>>(title field not set)"><> <$macrocall $name="edit-button" state=<>/> <> <$macrocall $name="help-button" state=<>/>
    <$macrocall $name="help-content" type="row" state=<>/> <$macrocall $name="expand-collapse-content" state=<> content=<> class="tc-import-spec-row"/>
    \end \define list-rows()
    <$list filter="[list]" variable="row" emptyMessage="
    (No row import specifiers)
    "> <> \end \define view-sheet-content() <$reveal state="""$:/state/edit/$(sheet)$""" type="match" text="yes" default="no" tag="ul" class="tc-import-spec-sheet-controls" animate="yes" retain="yes">
  • <$macrocall $name="delete-item-button" filter="[] [getlist[]] [getlist[]getlist[]]" parent=<> title=<> prompt=" Delete this sheet"/>
  • Title: <$tiddler tiddler=<>> <>
  • Import sheet name: <$edit-text tiddler=<> field="import-sheet-name" size="50"/>
  • <$button class="tc-btn-invisible"> <$action-createtiddler $basetitle="$:/_ExcelImporter/ImportSpecifiers/Row" $savetitle="$:/temp/newtiddler" import-spec-role="row"/> <$action-listops $tiddler=<> $subfilter="[{$:/temp/newtiddler}]"/> <$action-setfield $tiddler={{{ [{$:/temp/newtiddler}addprefix[$:/state/edit/]] }}} $value="yes"/> <$action-setfield $tiddler={{{ [{$:/temp/newtiddler}addprefix[$:/state/expand/]] }}} $value="yes"/> {{$:/core/images/new-button}} Add new row
  • <> \end \define view-sheet()

    <$macrocall $name="expand-collapse-button" state=<>/> Sheet: <$link to=<>><$view tiddler=<> field="import-sheet-name"/> <$macrocall $name="edit-button" state=<>/> <> <$macrocall $name="help-button" state=<>/>

    <$macrocall $name="help-content" type="sheet" state=<>/> <$macrocall $name="expand-collapse-content" state=<> content=<> class="tc-import-spec-sheet"/>
    \end \define list-sheets()
    <$list filter="[list]" variable="sheet" emptyMessage="
    (No sheet import specifiers)
    "> <>
    \end \define view-workbook-content() <$reveal state="""$:/state/edit/$(workbook)$""" type="match" text="yes" default="no" tag="ul" class="tc-import-spec-workbook-controls" animate="yes" retain="yes">
  • <$macrocall $name="delete-item-button" filter="[] [getlist[]] [getlist[]getlist[]] [getlist[]getlist[]getlist[]]" prompt=" Delete this workbook"/>
  • Title: <$tiddler tiddler=<>> <>
  • Caption: <$edit-text tiddler=<> field="caption" size="50"/>
  • <$button class="tc-btn-invisible"> <$action-createtiddler $basetitle="$:/_ExcelImporter/ImportSpecifiers/Sheet" $savetitle="$:/temp/newtiddler" import-spec-role="sheet" import-sheet-name="Sheet name"/> <$action-listops $tiddler=<> $subfilter="[{$:/temp/newtiddler}]"/> <$action-setfield $tiddler={{{ [{$:/temp/newtiddler}addprefix[$:/state/edit/]] }}} $value="yes"/> <$action-setfield $tiddler={{{ [{$:/temp/newtiddler}addprefix[$:/state/expand/]] }}} $value="yes"/> {{$:/core/images/new-button}} Add new sheet
  • <> \end \define view-workbook()

    <$macrocall $name="expand-collapse-button" state=<>/> Workbook: <$link to=<>><$view tiddler=<> field="caption"/> <$macrocall $name="edit-button" state=<>/> <$macrocall $name="help-button" state=<>/>

    <$macrocall $name="help-content" type="workbook" state=<>/> <$macrocall $name="expand-collapse-content" state=<> content=<> class="tc-import-spec-workbook"/>
    \end \define list-workbooks()
    • <$button class="tc-btn-invisible"> <$action-createtiddler $basetitle="$:/_ExcelImporter/ImportSpecifiers/Workbook" $savetitle="$:/temp/newtiddler" import-spec-role="workbook" caption="New workbook"/> <$action-setfield $tiddler={{{ [{$:/temp/newtiddler}addprefix[$:/state/edit/]] }}} $value="yes"/> <$action-setfield $tiddler={{{ [{$:/temp/newtiddler}addprefix[$:/state/expand/]] }}} $value="yes"/> {{$:/core/images/new-button}} Add new workbook
    <$list filter="[all[shadows+tiddlers]import-spec-role[workbook]sort[caption]]" variable="workbook"> <>
    \end

    Controls for XLSX Spreadsheet Utilities

    Current Import Specification

    <$list filter="[all[shadows+tiddlers]import-spec-role[workbook]limit[1]]" emptyMessage=""" There are no import specifications available. Use the controls below to create one """> This is the import specification that will be used for the next import of an `.XLSX` file <$select tiddler="$:/config/plugins/tiddlywiki/xlsx-utils/default-import-spec"> <$list filter="[all[shadows+tiddlers]import-spec-role[workbook]sort[caption]]">

    Import Specifications <$macrocall $name="help-button" state=""/>

    <$macrocall $name="help-content" type="editor" state=""/>
    <>