是否有R函数将Excel文件导出/转换为文本文件?

时间:2019-08-14 19:16:05

标签: r

我正在尝试找到将excel文件转换为文本文件的代码。

这是Excel工作簿的代码。我想将其转换为文本文件。

template <- loadWorkbook('V:/rcode/template.xlsx')

writeData(template,'sheet1',finaloutput, startRow =1,startCol = 3, colNames = FALSE)

workbook<- paste0("V:/rcode/", 'template', ".xlsx")

saveWorkbook(template, workbook, overwrite = TRUE)

2 个答案:

答案 0 :(得分:1)

使用readxl::read_excel()将Excel文件读取到数据框(在技术上为小标题),以纯文本文件形式写入。

library(tidyverse)   
library(readxl)

finaloutput <- read_excel("V:/rcode/template.xlsx", sheet=1, skip=0, range = cell_cols(c(3, NA)), col_names=FALSE)

read_xlsx也可以使用,因为您知道扩展名为.xlsx

write.table(finaloutput,"path",...) 

答案 1 :(得分:0)

这对我有用。

<nav>
   <div class="nav nav-tabs" id="nav-tab" role="tablist">
      @foreach($categories as $count => $category)
      <a  id="nav-home-tab-{{$category->id}}" data-toggle="tab" href="#nav-home-{{$category->id}}" role="tab" aria-controls="nav-home" aria-selected="true"
      @if($count == 0) class="nav-item nav-link active" @else()class="nav-item nav-link "@endif>{{$category->title}}</a>
      @endforeach
   </div>
</nav>
<div class="tab-content" id="nav-tabContent">
   @foreach($categories as $count => $category)
   <div @if($count == 0) class="tab-pane fade show active" @else class="tab-pane fade" @endif id="nav-home-{{$category->id}}"
   role="tabpanel" aria-labelledby="nav-home-tab-{{$category->id}}">
   <div class="row ">
      @foreach($category->articles as $article)
      <div class="col-md-3">
         <div class="box mt-2 mb-2">
            <img src="{{ $article->images ['thumb'] }}">
            <h2>قالب بوتسراپ شرکتی</h2>
            <p>قالب بوت استراپ شرکتی کاملا فارسی سازی شده و رایگان میتوانید دانلود کنید</p>
            <div class=" download-btn">
               <a href="#" class="btn btn-sm btn-primary mb-1"><i class="fa fa-download"></i> دانلود قالب </a>
               <a href="#" class="btn btn-sm btn-dark mb-1 float-left"><i class="fa fa-laptop"></i> دموی قالب </a>
            </div>
         </div>
      </div>
      @endforeach
   </div>
</div>
@endforeach
</div>